From 529f0ebcd186a0a721a7b6e015b6df6819ec15e3 Mon Sep 17 00:00:00 2001 From: ThomasJejkal Date: Tue, 18 Apr 2023 05:20:31 +0000 Subject: [PATCH 01/49] Create PR for #116 From 5bbcfaf11ae128abb164d41d7ca1525c1260b398 Mon Sep 17 00:00:00 2001 From: ThomasJejkal Date: Wed, 31 May 2023 10:03:44 +0000 Subject: [PATCH 02/49] Create PR for #118 From 38e6b4b180ca62cedc218c2b05e699b260215aa0 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Wed, 31 May 2023 12:05:29 +0200 Subject: [PATCH 03/49] Fix 118, Added system property org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true at startup --- src/main/java/edu/kit/datamanager/repo/Application.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/edu/kit/datamanager/repo/Application.java b/src/main/java/edu/kit/datamanager/repo/Application.java index 92c38a72..1c3f8b2b 100644 --- a/src/main/java/edu/kit/datamanager/repo/Application.java +++ b/src/main/java/edu/kit/datamanager/repo/Application.java @@ -263,6 +263,7 @@ public RepoBaseConfiguration repositoryConfig() { } public static void main(String[] args) { + System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true"); ApplicationContext ctx = SpringApplication.run(Application.class, args); System.out.println("Spring is running!"); From e0a4890731b66af36f7f39014bcfa025e5112fef Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Wed, 28 Jun 2023 13:45:32 +0200 Subject: [PATCH 04/49] Started updating to spring-boot 3.1.0 --- build.gradle | 71 ++++++++++--------- gradle.properties | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- .../configuration/ElasticConfiguration.java | 6 +- .../repo/configuration/WebSecurityConfig.java | 42 +++++------ .../web/IDataResourceAuditController.java | 2 +- .../repo/web/IDataResourceController.java | 6 +- .../web/impl/DataResourceAuditController.java | 4 +- .../repo/web/impl/DataResourceController.java | 2 +- 9 files changed, 71 insertions(+), 65 deletions(-) diff --git a/build.gradle b/build.gradle index d425584d..27ba5f16 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,12 @@ plugins { - id "org.springframework.boot" version "2.7.5" - id "io.spring.dependency-management" version "1.1.0" - id "io.freefair.lombok" version "6.5.1" - id "io.freefair.maven-publish-java" version "6.5.1" - id "com.github.kt3k.coveralls" version "2.12.0" - id "org.owasp.dependencycheck" version "7.3.0" + id 'org.springframework.boot' version '3.1.0' + id 'io.spring.dependency-management' version '1.1.0' + id 'io.freefair.lombok' version '8.0.1' + id 'io.freefair.maven-publish-java' version '8.0.1' + id 'org.owasp.dependencycheck' version '8.2.1' id 'org.asciidoctor.jvm.convert' version '3.3.2' - id "net.researchgate.release" version "3.0.2" - id "com.gorylenko.gradle-git-properties" version "2.4.1" + id 'net.researchgate.release' version '3.0.2' + id 'com.gorylenko.gradle-git-properties' version '2.4.1' id 'java' id 'jacoco' } @@ -29,9 +28,9 @@ repositories { //} ext { - set('javersVersion', "6.8.0") - set('springBootVersion', "2.7.5") - set('springDocVersion', "1.6.9") + set('javersVersion', "7.0.0") + set('springBootVersion', "3.1.0") + set('springDocVersion', "2.1.0") set('keycloakVersion', "19.0.0") // directory for generated code snippets during tests @@ -42,8 +41,8 @@ println "Running gradle version: $gradle.gradleVersion" println "Building ${name} version: ${version}" println "JDK version: ${JavaVersion.current()}" -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +sourceCompatibility = 1.17 +targetCompatibility = 1.17 if (System.getProperty('profile') == 'minimal') { println 'Using minimal profile for building ' + project.getName() @@ -60,57 +59,61 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-data-rest" implementation "org.springframework.boot:spring-boot-starter-mail" implementation "org.springframework.boot:spring-boot-starter-actuator" - implementation 'org.springframework.data:spring-data-elasticsearch:4.4.6' + implementation 'org.springframework.data:spring-data-elasticsearch:5.1.0' - implementation "org.springframework:spring-messaging:5.3.23" - implementation "org.springframework.security:spring-security-web:5.7.5" - implementation "org.springframework.security:spring-security-config:5.7.5" + implementation("org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.5"){ + exclude group: "commons-logging", module: "commons-logging" + } + + implementation "org.springframework:spring-messaging:6.0.2" + // implementation "org.springframework.security:spring-security-web:6.1.1" + // implementation "org.springframework.security:spring-security-config:6.1.1" // cloud support - implementation "org.springframework.cloud:spring-cloud-starter-config:3.1.5" - implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:3.1.4" - implementation "org.springframework.cloud:spring-cloud-gateway-mvc:3.1.4" - implementation 'de.codecentric:spring-boot-admin-starter-client:2.7.10' + implementation "org.springframework.cloud:spring-cloud-starter-config:3.1.7" + implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:3.1.6" + implementation "org.springframework.cloud:spring-cloud-gateway-mvc:3.1.7" + implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.0' // springdoc - implementation "org.springdoc:springdoc-openapi-ui:${springDocVersion}" - implementation "org.springdoc:springdoc-openapi-data-rest:${springDocVersion}" - implementation "org.springdoc:springdoc-openapi-webmvc-core:${springDocVersion}" + implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springDocVersion}" + implementation "org.springdoc:springdoc-openapi-starter-common:${springDocVersion}" + implementation "org.springdoc:springdoc-openapi-starter-webmvc-api:${springDocVersion}" - implementation "edu.kit.datamanager:repo-core:1.1.2" - implementation "edu.kit.datamanager:service-base:1.1.1" + implementation "edu.kit.datamanager:repo-core:1.2.1" + implementation "edu.kit.datamanager:service-base:1.2.0" //implementation "com.github.victools:jsonschema-generator:4.23.0" //Keycloak // implementation "org.keycloak:keycloak-spring-boot-starter:${keycloakVersion}" implementation "com.nimbusds:nimbus-jose-jwt:9.24.3" - implementation "io.jsonwebtoken:jjwt-api:0.11.5" - implementation "io.jsonwebtoken:jjwt-impl:0.11.5" - implementation "io.jsonwebtoken:jjwt-jackson:0.11.5" + // implementation "io.jsonwebtoken:jjwt-api:0.11.5" + //implementation "io.jsonwebtoken:jjwt-impl:0.11.5" + //implementation "io.jsonwebtoken:jjwt-jackson:0.11.5" implementation "org.javers:javers-core:${javersVersion}" implementation "com.github.fge:json-patch:1.9" implementation "com.bazaarvoice.jolt:jolt-core:0.1.7" implementation "com.bazaarvoice.jolt:json-utils:0.1.7" - implementation "javax.xml.bind:jaxb-api:2.3.1" + // implementation "javax.xml.bind:jaxb-api:2.3.1" - runtimeOnly "org.apache.httpcomponents:httpclient:4.5.13" + runtimeOnly "org.apache.httpcomponents:httpclient:4.5.14" // driver for postgres - implementation "org.postgresql:postgresql:42.5.0" + implementation "org.postgresql:postgresql:42.6.0" //driver for h2 implementation "com.h2database:h2:2.1.214" - testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc:2.0.6.RELEASE" + testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc:3.0.0" testImplementation "org.springframework.boot:spring-boot-starter-test" testImplementation "org.springframework:spring-test" testImplementation "org.springframework.security:spring-security-test" //Java 11 Support - testImplementation "org.mockito:mockito-inline:4.9.0" + testImplementation "org.mockito:mockito-inline:5.2.0" testImplementation "junit:junit:4.13.2" } diff --git a/gradle.properties b/gradle.properties index b6ed0ff0..f99caa82 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,3 +7,4 @@ action.custom-2=release action.custom-2.args=--configure-on-demand -w -x check -Dprofile=minimal clean build asciidoctor action.custom-3=jacoco action.custom-3.args=--configure-on-demand -w -x check clean build jacocoTestReport +netbeans.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702..774fae87 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java b/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java index f1bd400b..703ab367 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java @@ -16,16 +16,16 @@ package edu.kit.datamanager.repo.configuration; import edu.kit.datamanager.configuration.SearchConfiguration; -import org.elasticsearch.client.RestHighLevelClient; +import java.net.http.HttpHeaders; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.elasticsearch.client.ClientConfiguration; -import org.springframework.data.elasticsearch.client.RestClients; +import org.springframework.data.elasticsearch.client.erhlc.ElasticsearchRestTemplate; +import org.springframework.data.elasticsearch.client.erhlc.RestClients; import org.springframework.data.elasticsearch.core.ElasticsearchOperations; -import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.http.HttpHeaders; diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java b/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java index 1b580c5c..5748fae3 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java @@ -30,10 +30,10 @@ 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.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import org.springframework.security.web.firewall.DefaultHttpFirewall; import org.springframework.security.web.firewall.HttpFirewall; @@ -48,7 +48,7 @@ @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { +public class WebSecurityConfig { private static final Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); @@ -65,17 +65,16 @@ public WebSecurityConfig() { // public void configure(AuthenticationManagerBuilder auth) throws Exception { // auth.authenticationEventPublisher(new NoopAuthenticationEventPublisher()).authenticationProvider(new JwtAuthenticationProvider(applicationProperties.getJwtSecret(), logger)); // } - @Override - protected void configure(HttpSecurity http) throws Exception { + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { HttpSecurity httpSecurity = http.authorizeRequests(). + antMatchers(HttpMethod.OPTIONS, "/**").permitAll(). requestMatchers(EndpointRequest.to( InfoEndpoint.class, HealthEndpoint.class )).permitAll(). requestMatchers(EndpointRequest.toAnyEndpoint()). // - hasAnyRole("ADMIN", "ACTUATOR"). // - antMatchers(HttpMethod.OPTIONS, "/**"). - permitAll().and(). + hasAnyRole("ADMIN", "ACTUATOR").and(). sessionManagement(). sessionCreationPolicy(SessionCreationPolicy.STATELESS). and() @@ -98,8 +97,13 @@ protected void configure(HttpSecurity http) throws Exception { antMatchers("/api/v1").authenticated(); http.headers().cacheControl().disable(); + return http.build(); } + /*@Override + protected void configure(HttpSecurity http) throws Exception { + + }*/ @Bean public HttpFirewall allowUrlEncodedSlashHttpFirewall() { DefaultHttpFirewall firewall = new DefaultHttpFirewall(); @@ -107,20 +111,18 @@ public HttpFirewall allowUrlEncodedSlashHttpFirewall() { return firewall; } - @Override - public void configure(WebSecurity web) throws Exception { - web.httpFirewall(allowUrlEncodedSlashHttpFirewall()); + @Bean + public WebSecurityCustomizer webSecurityCustomizer() { + return (web) -> web.httpFirewall(allowUrlEncodedSlashHttpFirewall()); + } + + @Bean + public HttpFirewall allowUrlEncodedSlashHttpFirewall() { + DefaultHttpFirewall firewall = new DefaultHttpFirewall(); + firewall.setAllowUrlEncodedSlash(true); + return firewall; } -// @Bean -// CorsConfigurationSource corsConfigurationSource(){ -// final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); -// CorsConfiguration config = new CorsConfiguration(); -// config.addAllowedOrigin("http://localhost:3000"); -// -// source.registerCorsConfiguration("/**", config); -// return source; -// } @Bean public FilterRegistrationBean corsFilter() { final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); diff --git a/src/main/java/edu/kit/datamanager/repo/web/IDataResourceAuditController.java b/src/main/java/edu/kit/datamanager/repo/web/IDataResourceAuditController.java index 11d40602..4de1907a 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/IDataResourceAuditController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/IDataResourceAuditController.java @@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; diff --git a/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java b/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java index 95b7b503..1ace3d00 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java @@ -23,12 +23,12 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import java.awt.PageAttributes.MediaType; +import java.awt.print.Pageable; import java.time.Instant; import java.util.List; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.springdoc.core.converters.models.PageableAsQueryParam; -import org.springframework.data.domain.Pageable; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; diff --git a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceAuditController.java b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceAuditController.java index 555c503c..7eeba597 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceAuditController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceAuditController.java @@ -31,7 +31,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Optional; import java.util.function.Function; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -125,7 +125,7 @@ public ResponseEntity getContentAuditInformation(@PathVariable("id") final Strin return ResponseEntity.ok().header(VERSION_HEADER, Long.toString(currentVersion)).body(auditInformation.get()); } - + @Override public ResponseEntity getAuditInformation( @Parameter(description = "The resource identifier.", required = true) @PathVariable(value = "id") final String resourceIdentifier, diff --git a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java index e4917bfb..d6d0b273 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java @@ -24,7 +24,7 @@ import edu.kit.datamanager.repo.configuration.RepoBaseConfiguration; import edu.kit.datamanager.repo.dao.IContentInformationDao; import edu.kit.datamanager.repo.dao.IDataResourceDao; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; From b4faa9e7188f76a2d92fd4d0dcbf09d9a2735dd9 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Mon, 31 Jul 2023 12:50:37 +0200 Subject: [PATCH 05/49] Migration to Spring Boot 3 finished --- build.gradle | 10 +- .../edu/kit/datamanager/repo/Application.java | 36 ++---- .../configuration/ElasticConfiguration.java | 66 +++++----- .../repo/configuration/WebSecurityConfig.java | 119 ++++++++---------- .../repo/elastic/DataResourceRepository.java | 5 +- .../repo/web/IDataResourceController.java | 4 +- .../repo/web/impl/DataResourceController.java | 10 +- 7 files changed, 109 insertions(+), 141 deletions(-) diff --git a/build.gradle b/build.gradle index 27ba5f16..e36419cf 100644 --- a/build.gradle +++ b/build.gradle @@ -66,13 +66,13 @@ dependencies { } implementation "org.springframework:spring-messaging:6.0.2" - // implementation "org.springframework.security:spring-security-web:6.1.1" - // implementation "org.springframework.security:spring-security-config:6.1.1" + implementation "org.springframework.security:spring-security-web:6.1.1" + implementation "org.springframework.security:spring-security-config:6.1.1" // cloud support - implementation "org.springframework.cloud:spring-cloud-starter-config:3.1.7" - implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:3.1.6" - implementation "org.springframework.cloud:spring-cloud-gateway-mvc:3.1.7" + implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.3" + implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.2" + implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.0.6" implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.0' diff --git a/src/main/java/edu/kit/datamanager/repo/Application.java b/src/main/java/edu/kit/datamanager/repo/Application.java index 1c3f8b2b..26e66e5b 100644 --- a/src/main/java/edu/kit/datamanager/repo/Application.java +++ b/src/main/java/edu/kit/datamanager/repo/Application.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import edu.kit.datamanager.configuration.SearchConfiguration; import edu.kit.datamanager.repo.configuration.ApplicationProperties; +import edu.kit.datamanager.repo.configuration.ElasticConfiguration; import edu.kit.datamanager.repo.configuration.RepoBaseConfiguration; import edu.kit.datamanager.repo.configuration.StorageServiceProperties; import edu.kit.datamanager.repo.domain.DataResource; @@ -47,6 +48,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.scope.refresh.RefreshScopeRefreshedEvent; import org.springframework.context.ApplicationContext; @@ -58,6 +60,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; /** * @@ -66,6 +69,8 @@ @SpringBootApplication @EnableScheduling @ComponentScan({"edu.kit.datamanager"}) +@EnableElasticsearchRepositories(basePackages = "edu.kit.datamanager.repo.elastic") +@EntityScan("edu.kit.datamanager") // if you have it public class Application { private static final Logger LOG = LoggerFactory.getLogger(Application.class); @@ -91,13 +96,12 @@ public class Application { private IContentInformationService contentInformationService;*/ // @Autowired // private RequestMappingHandlerAdapter requestMappingHandlerAdapter; - @Bean - @Scope("prototype") - public Logger logger(InjectionPoint injectionPoint) { - Class targetClass = injectionPoint.getMember().getDeclaringClass(); - return LoggerFactory.getLogger(targetClass.getCanonicalName()); - } - +// @Bean +// @Scope("prototype") +// public Logger logger(InjectionPoint injectionPoint) { +// Class targetClass = injectionPoint.getMember().getDeclaringClass(); +// return LoggerFactory.getLogger(targetClass.getCanonicalName()); +// } @Bean public IDataResourceService dataResourceService() { return new DataResourceService(); @@ -166,7 +170,7 @@ public DateBasedStorageProperties dateBasedStorageProperties() { public StorageServiceProperties storageServiceProperties() { return new StorageServiceProperties(); } - + @Bean @ConfigurationProperties("repo") @ConditionalOnProperty(prefix = "repo.messaging", name = "enabled", havingValue = "true") @@ -174,22 +178,6 @@ public Optional messagingService() { return Optional.of(new RabbitMQMessagingService()); } -// @Bean -// @ConditionalOnProperty(name = "spring.config.location", matchIfMissing = true) -// public PropertiesConfiguration applicationProperties(@Value("${spring.config.location}") String path) throws Exception { -// String filePath = new File(path.substring("file:".length())).getCanonicalPath(); -// LOG.info("READING applicationProperties FROM {}", filePath); -// PropertiesConfiguration configuration = new PropertiesConfiguration(new File(filePath)); -// configuration.setReloadingStrategy(new FileChangedReloadingStrategy() { -// @Override -// protected boolean hasChanged() { -// System.out.println("RELOADING BASE " + repositoryConfig()); -// return super.hasChanged(); //To change body of generated methods, choose Tools | Templates. -// } -// -// }); -// return configuration; -// } @Bean public KeycloakJwtProperties keycloakProperties() { return new KeycloakJwtProperties(); diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java b/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java index 703ab367..7655aad2 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java @@ -16,54 +16,50 @@ package edu.kit.datamanager.repo.configuration; import edu.kit.datamanager.configuration.SearchConfiguration; -import java.net.http.HttpHeaders; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.elasticsearch.client.ClientConfiguration; -import org.springframework.data.elasticsearch.client.erhlc.ElasticsearchRestTemplate; -import org.springframework.data.elasticsearch.client.erhlc.RestClients; -import org.springframework.data.elasticsearch.core.ElasticsearchOperations; -import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; -import org.springframework.http.HttpHeaders; +import org.springframework.data.elasticsearch.client.elc.ElasticsearchClients; +import org.springframework.data.elasticsearch.client.elc.ElasticsearchConfiguration; +import org.springframework.data.elasticsearch.support.HttpHeaders; /** * * @author jejkal */ @Configuration -@EnableElasticsearchRepositories(basePackages = "edu.kit.datamanager.repo") -@ComponentScan(basePackages = {"edu.kit.datamanager"}) -@ConditionalOnProperty(prefix = "repo.search", name = "enabled", havingValue = "true") -public class ElasticConfiguration { +@ConditionalOnProperty(prefix = "repo.search", name="enabled", havingValue = "true", matchIfMissing = false) +public class ElasticConfiguration extends ElasticsearchConfiguration { @Autowired private SearchConfiguration searchConfiguration; - @Bean - public RestHighLevelClient client() { - //required for compatibility to Elastic 8.X ... might not work and should be removed with spring-boot 3.X - HttpHeaders compatibilityHeaders = new HttpHeaders(); - compatibilityHeaders.add("Accept", "application/vnd.elasticsearch+json;compatible-with=7"); - compatibilityHeaders.add("Content-Type", "application/vnd.elasticsearch+json;compatible-with=7"); - - String indexUrl = searchConfiguration.getUrl().toString(); - String hostnamePort = indexUrl.substring(indexUrl.indexOf("//") + 2); - - ClientConfiguration clientConfiguration - = ClientConfiguration.builder() - .connectedTo(hostnamePort) - .withDefaultHeaders(compatibilityHeaders) - .build(); - - return RestClients.create(clientConfiguration).rest(); + @Override + public ClientConfiguration clientConfiguration() { + // HttpHeaders httpHeaders = new HttpHeaders(); + // httpHeaders.add("some-header", "on every request"); + ClientConfiguration clientConfiguration = ClientConfiguration.builder() + .connectedTo("localhost:9200", "localhost:9291") + //.usingSsl() + //.withProxy("localhost:8888") + .withConnectTimeout(Duration.ofSeconds(5)) + .withSocketTimeout(Duration.ofSeconds(3)) + //.withDefaultHeaders(defaultHeaders) + //.withBasicAuth(username, password) + .withHeaders(() -> { + HttpHeaders headers = new HttpHeaders(); + headers.add("currentTime", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); + return headers; + }) + .withClientConfigurer( + ElasticsearchClients.ElasticsearchRestClientConfigurationCallback.from(clientBuilder -> { + return clientBuilder; + })) + .build(); + return clientConfiguration; } - - @Bean - public ElasticsearchOperations elasticsearchTemplate() { - return new ElasticsearchRestTemplate(client()); - } - } diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java b/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java index 5748fae3..f7ceb31d 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java @@ -17,6 +17,8 @@ import edu.kit.datamanager.security.filter.KeycloakTokenFilter; import edu.kit.datamanager.security.filter.NoAuthenticationFilter; +import edu.kit.datamanager.security.filter.PublicAuthenticationFilter; +import jakarta.servlet.Filter; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +30,8 @@ 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.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; @@ -47,11 +50,26 @@ */ @Configuration @EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) +@EnableMethodSecurity(prePostEnabled = true) public class WebSecurityConfig { private static final Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); + private static final String[] AUTH_WHITELIST_SWAGGER_UI = { + // -- Swagger UI v2 + "/v2/api-docs", + "/swagger-resources", + "/swagger-resources/**", + "/configuration/ui", + "/configuration/security", + "/swagger-ui.html", + "/webjars/**", + // -- Swagger UI v3 (OpenAPI) + "/v3/api-docs/**", + "/swagger-ui/**" + // other public endpoints of your API may be appended to this array + }; + @Autowired private ApplicationProperties applicationProperties; @@ -61,54 +79,42 @@ public class WebSecurityConfig { public WebSecurityConfig() { } -// @Override -// public void configure(AuthenticationManagerBuilder auth) throws Exception { -// auth.authenticationEventPublisher(new NoopAuthenticationEventPublisher()).authenticationProvider(new JwtAuthenticationProvider(applicationProperties.getJwtSecret(), logger)); -// } @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - HttpSecurity httpSecurity = http.authorizeRequests(). - antMatchers(HttpMethod.OPTIONS, "/**").permitAll(). - requestMatchers(EndpointRequest.to( - InfoEndpoint.class, - HealthEndpoint.class - )).permitAll(). - requestMatchers(EndpointRequest.toAnyEndpoint()). // - hasAnyRole("ADMIN", "ACTUATOR").and(). - sessionManagement(). - sessionCreationPolicy(SessionCreationPolicy.STATELESS). - and() - .csrf().disable(); - // .addFilterBefore(corsFilter(), SessionManagementFilter.class) - // .addFilterAfter(new JwtAuthenticationFilter(authenticationManager()), BasicAuthenticationFilter.class) + HttpSecurity httpSecurity = http.authorizeHttpRequests( + authorize -> authorize.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll(). + requestMatchers("/oaipmh").permitAll(). + requestMatchers("/static/**").permitAll(). + requestMatchers(AUTH_WHITELIST_SWAGGER_UI).permitAll(). + requestMatchers(EndpointRequest.to( + InfoEndpoint.class, + HealthEndpoint.class + )).permitAll(). + requestMatchers(EndpointRequest.toAnyEndpoint()).hasAnyRole("ANONYMOUS", "ADMIN", "ACTUATOR", "SERVICE_WRITE"). + requestMatchers("/**").authenticated()). + sessionManagement( + session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)); + logger.info("Disable CSRF"); + httpSecurity = httpSecurity.csrf(csrf -> csrf.disable()); + + logger.info("Adding 'NoAuthenticationFilter' to authentication chain."); if (keycloaktokenFilterBean.isPresent()) { + logger.info("Add keycloak filter!"); httpSecurity.addFilterAfter(keycloaktokenFilterBean.get(), BasicAuthenticationFilter.class); + logger.info("Add public authentication filter!"); + httpSecurity = httpSecurity.addFilterAfter(new PublicAuthenticationFilter(applicationProperties.getJwtSecret()), BasicAuthenticationFilter.class); } - if (!applicationProperties.isAuthEnabled()) { logger.info("Authentication is DISABLED. Adding 'NoAuthenticationFilter' to authentication chain."); - httpSecurity = httpSecurity.addFilterAfter(new NoAuthenticationFilter(applicationProperties.getJwtSecret(), authenticationManager()), BasicAuthenticationFilter.class); + AuthenticationManager defaultAuthenticationManager = http.getSharedObject(AuthenticationManager.class); + httpSecurity = httpSecurity.addFilterAfter(new NoAuthenticationFilter(applicationProperties.getJwtSecret(), defaultAuthenticationManager), BasicAuthenticationFilter.class); } else { logger.info("Authentication is ENABLED."); } - httpSecurity. - authorizeRequests(). - antMatchers("/api/v1").authenticated(); + httpSecurity.headers(headers -> headers.cacheControl(cache -> cache.disable())); - http.headers().cacheControl().disable(); - return http.build(); - } - - /*@Override - protected void configure(HttpSecurity http) throws Exception { - - }*/ - @Bean - public HttpFirewall allowUrlEncodedSlashHttpFirewall() { - DefaultHttpFirewall firewall = new DefaultHttpFirewall(); - firewall.setAllowUrlEncodedSlash(true); - return firewall; + return httpSecurity.build(); } @Bean @@ -124,48 +130,25 @@ public HttpFirewall allowUrlEncodedSlashHttpFirewall() { } @Bean + @SuppressWarnings("StringSplitter") public FilterRegistrationBean corsFilter() { final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); + // String[] allOrigins = allowedOriginPattern.split("[ ]*,[ ]*"); + //for (String origin : allOrigins) { + // logger.info("Add origin pattern: '{}'", origin); config.addAllowedOriginPattern("*"); // @Value: http://localhost:8080 + // } config.addAllowedHeader("*"); config.addAllowedMethod("*"); config.addExposedHeader("Content-Range"); config.addExposedHeader("ETag"); source.registerCorsConfiguration("/**", config); - FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); + FilterRegistrationBean bean; + bean = new FilterRegistrationBean<>(new CorsFilter(source)); bean.setOrder(0); return bean; } - -// @Bean -// CorsConfigurationSource corsConfigurationSource(){ -// CorsConfiguration configuration = new CorsConfiguration(); -// configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000")); -// configuration.setAllowedMethods(Arrays.asList("GET", "POST, PATCH, DELETE, OPTIONS, HEAD")); -// configuration.setAllowedHeaders(Arrays.asList("content-range", "authorization", "location")); -// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); -// source.registerCorsConfiguration("/**", configuration); -// return source; -// } -// @Bean -// CorsFilter corsFilter(){ -// CorsFilter filter = new CorsFilter(); -// return filter; -// } -// @Bean -// public WebMvcConfigurer corsConfigurer() { -// return new WebMvcConfigurerAdapter() { -// @Override -// public void addCorsMappings(CorsRegistry registry) { -// registry.addMapping("/greeting-javaconfig").allowedOrigins("http://localhost:9000"); -// } -// }; -// } -// @Bean -// public UserRepositoryImpl userRepositoryImpl(){ -// return new UserRepositoryImpl(); -// } } diff --git a/src/main/java/edu/kit/datamanager/repo/elastic/DataResourceRepository.java b/src/main/java/edu/kit/datamanager/repo/elastic/DataResourceRepository.java index b296b709..d20508dc 100644 --- a/src/main/java/edu/kit/datamanager/repo/elastic/DataResourceRepository.java +++ b/src/main/java/edu/kit/datamanager/repo/elastic/DataResourceRepository.java @@ -15,7 +15,8 @@ */ package edu.kit.datamanager.repo.elastic; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import edu.kit.datamanager.repo.configuration.ElasticConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; @@ -27,7 +28,7 @@ * @author jejkal */ @Repository -@ConditionalOnProperty(prefix = "repo.search", name = "enabled", havingValue = "true") +@ConditionalOnBean(ElasticConfiguration.class) public interface DataResourceRepository extends ElasticsearchRepository { Page findById(String id, Pageable pageable); diff --git a/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java b/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java index 1ace3d00..554137fb 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/IDataResourceController.java @@ -23,12 +23,12 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import java.awt.PageAttributes.MediaType; -import java.awt.print.Pageable; import java.time.Instant; import java.util.List; import jakarta.servlet.http.HttpServletResponse; import org.springdoc.core.converters.models.PageableAsQueryParam; +import org.springframework.data.domain.Pageable; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; diff --git a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java index d6d0b273..4097ded4 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java @@ -46,18 +46,15 @@ import edu.kit.datamanager.util.ControllerUtils; import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; import java.time.Instant; -import java.util.Iterator; import java.util.List; import java.util.Optional; import java.util.function.Function; import org.apache.http.client.utils.URIBuilder; -import org.javers.common.collections.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -86,8 +83,9 @@ public class DataResourceController implements IDataResourceController { private final Logger LOGGER = LoggerFactory.getLogger(DataResourceController.class); private final IContentInformationService contentInformationService; + @Autowired - private ApplicationProperties applicationProperties; + private final ApplicationProperties applicationProperties; @Autowired private IDataResourceDao dataResourceDao; @@ -399,7 +397,7 @@ public ResponseEntity getContentMetadata(@PathVariable(value = "id") final Strin } else { LOGGER.trace("Obtained single content information result."); ContentInformation contentInformation = result.get(0); - + long currentVersion = contentAuditService.getCurrentVersion(Long.toString(contentInformation.getId())); if (currentVersion > 0) { return ResponseEntity.ok().eTag("\"" + contentInformation.getEtag() + "\"").header(VERSION_HEADER, Long.toString(currentVersion)).body(fixContentInformation(contentInformation, version)); @@ -577,6 +575,8 @@ private void indexResource( } LOGGER.trace("Indexing Elastic wrapper."); dataResourceRepository.get().save(wrapper); + } else { + LOGGER.trace("No Elastic repository found. Skipping indexing of resource."); } } From 761482de2b29ab1871174f14341f4cdddfe29344 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Mon, 31 Jul 2023 13:00:01 +0200 Subject: [PATCH 06/49] Update gradle.yml Update Java build version to 17 --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fa2c7146..e5f751e6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,7 +19,7 @@ jobs: matrix: operating-system: [ubuntu-latest, macOS-latest] # Use both LTS releases and latest one for tests - jdk: [ 8, 11 ] + jdk: [ 17 ] steps: - name: Checkout repo uses: actions/checkout@v2 From 5e5d0e2dcafc0c797aea420cfc6d3f8a25c54f73 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Mon, 31 Jul 2023 13:02:26 +0200 Subject: [PATCH 07/49] Update dependencies --- build.gradle | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index e36419cf..5ce465a1 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'io.spring.dependency-management' version '1.1.0' id 'io.freefair.lombok' version '8.0.1' id 'io.freefair.maven-publish-java' version '8.0.1' - id 'org.owasp.dependencycheck' version '8.2.1' + id 'org.owasp.dependencycheck' version '8.3.1' id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'net.researchgate.release' version '3.0.2' id 'com.gorylenko.gradle-git-properties' version '2.4.1' @@ -59,11 +59,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-data-rest" implementation "org.springframework.boot:spring-boot-starter-mail" implementation "org.springframework.boot:spring-boot-starter-actuator" - implementation 'org.springframework.data:spring-data-elasticsearch:5.1.0' - - implementation("org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.5"){ - exclude group: "commons-logging", module: "commons-logging" - } + implementation 'org.springframework.data:spring-data-elasticsearch:5.1.2' implementation "org.springframework:spring-messaging:6.0.2" implementation "org.springframework.security:spring-security-web:6.1.1" From 65f4d214ae96783fb3a879e73f654718870b82c5 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Mon, 31 Jul 2023 13:09:48 +0200 Subject: [PATCH 08/49] Update gradle.yml --- .github/workflows/gradle.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e5f751e6..cad6d2e5 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,13 +5,12 @@ name: build with gradle on: push: - branches: [ master, main, dev ] + branches: [ master, main, development ] pull_request: branches: [ master, main ] - env: # JDK version used for building jar file - currentBuildVersion: 8 + currentBuildVersion: 17 jobs: build: runs-on: ${{ matrix.operating-system }} From 634e4350f99d9e9edc9c916da8ffd8c0a69cdb1e Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Mon, 31 Jul 2023 13:11:44 +0200 Subject: [PATCH 09/49] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1dfba58d..8f4a78e0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -29,7 +29,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: 'zulu' - java-version: 11 + java-version: 17 - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle From bd15c479143edfe0e1ffc1fdbf77f97d09dfe74c Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Mon, 31 Jul 2023 13:22:11 +0200 Subject: [PATCH 10/49] Update codeql-analysis.yml Update CodeQL to v2 --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2d226d64..bed50f96 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 From d1dfa6467a570459039abc366dcbabbd223ce17f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:10:26 +0000 Subject: [PATCH 11/49] Bump com.bazaarvoice.jolt:json-utils from 0.1.7 to 0.1.8 Bumps [com.bazaarvoice.jolt:json-utils](https://github.com/bazaarvoice/jolt) from 0.1.7 to 0.1.8. - [Release notes](https://github.com/bazaarvoice/jolt/releases) - [Commits](https://github.com/bazaarvoice/jolt/compare/jolt-0.1.7...jolt-0.1.8) --- updated-dependencies: - dependency-name: com.bazaarvoice.jolt:json-utils dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5ce465a1..d98105b6 100644 --- a/build.gradle +++ b/build.gradle @@ -92,7 +92,7 @@ dependencies { implementation "org.javers:javers-core:${javersVersion}" implementation "com.github.fge:json-patch:1.9" implementation "com.bazaarvoice.jolt:jolt-core:0.1.7" - implementation "com.bazaarvoice.jolt:json-utils:0.1.7" + implementation "com.bazaarvoice.jolt:json-utils:0.1.8" // implementation "javax.xml.bind:jaxb-api:2.3.1" From 32fc297e4b2d9dabc904f859e76a26b124a4fd05 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Tue, 1 Aug 2023 14:19:01 +0200 Subject: [PATCH 12/49] Fix #131, user-provided @Ids are now removed --- .../datamanager/repo/util/EntityUtils.java | 77 ++++++++++++++++++ .../repo/web/impl/DataResourceController.java | 6 ++ .../repo/util/test/EntityUtilsTest.java | 81 +++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java create mode 100644 src/test/java/edu/kit/datamanager/repo/util/test/EntityUtilsTest.java diff --git a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java new file mode 100644 index 00000000..39b1e045 --- /dev/null +++ b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java @@ -0,0 +1,77 @@ +/* + * Copyright 2023 Karlsruhe Institute of Technology. + * + * 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 edu.kit.datamanager.repo.util; + +import jakarta.persistence.Id; +import java.lang.reflect.Field; +import java.lang.reflect.InaccessibleObjectException; +import java.util.Set; + +/** + * + * @author jejkal + */ +public class EntityUtils { + + public static void removeIds(Object originalObj) { + if (originalObj == null) { + System.out.println("NULL!"); + return; + } + for (Field field : originalObj.getClass().getDeclaredFields()) { + System.out.println("NEW FIELD " + field); + Id idField = field.getAnnotation(Id.class); + if (idField != null) { + //field is id field + field.setAccessible(true); + try { + if (field.get(originalObj) != null) { + //id field is set + System.out.println("REMOVE ID " + field); + field.set(originalObj, null); + } + } catch (IllegalArgumentException | IllegalAccessException ex) { + //update failed + System.out.println("NO ACCESS"); + } + } else if (Set.class.isAssignableFrom(field.getType())) { + field.setAccessible(true); + try { + Object val = field.get(originalObj); + if (val != null) { + for (Object v : (Set) val) { + removeIds(v); + } + } + } catch (IllegalArgumentException | IllegalAccessException ex) { + //update failed + System.out.println("NO ACCESS"); + } + } else if (!field.getType().isPrimitive() && !field.getType().isEnum() && field.getType().getPackageName().startsWith("edu.kit.datamanager")) { + try { + field.setAccessible(true); + Object val = field.get(originalObj); + if (val != null) { + removeIds(val); + } + } catch (IllegalArgumentException | IllegalAccessException | InaccessibleObjectException ex) { + //update failed + System.out.println("NO ACCESS"); + } + } + } + } +} diff --git a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java index 4097ded4..96c8b63c 100644 --- a/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java +++ b/src/main/java/edu/kit/datamanager/repo/web/impl/DataResourceController.java @@ -40,6 +40,7 @@ import edu.kit.datamanager.repo.service.IContentInformationService; import edu.kit.datamanager.repo.util.ContentDataUtils; import edu.kit.datamanager.repo.util.DataResourceUtils; +import edu.kit.datamanager.repo.util.EntityUtils; import edu.kit.datamanager.repo.web.IDataResourceController; import edu.kit.datamanager.service.IAuditService; import edu.kit.datamanager.util.AuthenticationHelper; @@ -125,6 +126,9 @@ public ResponseEntity create(@RequestBody final DataResource resou return WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(this.getClass()).getById(t, 1l, request, response)).toString(); }; + LOGGER.trace("Removing user-provided @Ids from resource."); + EntityUtils.removeIds(resource); + DataResource result = DataResourceUtils.createResource(repositoryProperties, resource); try { LOGGER.trace("Creating controller link for resource identifier {}.", result.getId()); @@ -330,6 +334,8 @@ public ResponseEntity createContent(@PathVariable(value = "id") final String ide LOGGER.trace("Reading user-provided content information."); try { info = new ObjectMapper().readValue(contentInformation.getInputStream(), ContentInformation.class); + LOGGER.trace("Removing user-provided @Ids from content information."); + EntityUtils.removeIds(info); } catch (IOException ex) { LOGGER.error("Unable to read content information metadata.", ex); return ResponseEntity.badRequest().body("Invalid ContentInformation metadata provided."); diff --git a/src/test/java/edu/kit/datamanager/repo/util/test/EntityUtilsTest.java b/src/test/java/edu/kit/datamanager/repo/util/test/EntityUtilsTest.java new file mode 100644 index 00000000..99fab7dd --- /dev/null +++ b/src/test/java/edu/kit/datamanager/repo/util/test/EntityUtilsTest.java @@ -0,0 +1,81 @@ +/* + * Copyright 2023 Karlsruhe Institute of Technology. + * + * 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 edu.kit.datamanager.repo.util.test; + +import edu.kit.datamanager.repo.domain.ContentInformation; +import edu.kit.datamanager.repo.domain.DataResource; +import edu.kit.datamanager.repo.domain.GeoLocation; +import edu.kit.datamanager.repo.domain.Point; +import edu.kit.datamanager.repo.domain.ResourceType; +import edu.kit.datamanager.repo.domain.Title; +import edu.kit.datamanager.repo.util.EntityUtils; +import org.junit.Assert; +import org.junit.Test; + +/** + * + * @author jejkal + */ +public class EntityUtilsTest { + + @Test + public void testRemoveIdsFromDataResource() { + DataResource res = DataResource.factoryDataResourceWithDoi("test123"); + res.setPublisher("test"); + //test top-level @Id + res.setId("123"); + + //test attribute-level @Id + ResourceType ty = ResourceType.createResourceType("test", ResourceType.TYPE_GENERAL.EVENT); + ty.setId(1l); + res.setResourceType(ty); + + //test collection-level @Id + Title t = Title.factoryTitle("title"); + t.setId(1l); + res.getTitles().add(t); + res.getSizes().add("12345"); + + //test collection-attribute-level @Id + Point p = Point.factoryPoint(1f, 1f); + p.setId(1l); + GeoLocation loc = GeoLocation.factoryGeoLocation(p); + loc.setId(1l); + res.getGeoLocations().add(loc); + + EntityUtils.removeIds(res); + + //top-level @Id should be null + Assert.assertNull(res.getId()); + //attribute-level @Id should be null + Assert.assertNull(res.getResourceType().getId()); + //collection-level @Id should be null + Assert.assertNull(res.getTitles().iterator().next().getId()); + //collection-attribute-level @Id should be null + Assert.assertNull(res.getGeoLocations().iterator().next().getPoint().getId()); + } + + @Test + public void testRemoveIdsFromContentInformation() { + ContentInformation info = ContentInformation.createContentInformation("data.json"); + info.setId(1l); + + EntityUtils.removeIds(info); + //top-level @Id should be null + Assert.assertNull(info.getId()); + } + +} From 236da8a171a492a81cb066f5f091c119e706c1b9 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Tue, 1 Aug 2023 15:15:36 +0200 Subject: [PATCH 13/49] Update changelog, cleanup and documentation of EntityUtils --- CHANGELOG.md | 32 ++++++++++++++++--- .../datamanager/repo/util/EntityUtils.java | 24 ++++++++++---- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7c40fd9..fb333a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,14 +6,36 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - -Security - -Added - Changed +* Java 17 is now mandatory +* Indexing support now requires Elastic 8+ Fixed +* Correctly ignore user-provided primary keys (https://github.com/kit-data-manager/base-repo/pull/131) + +Security +* Bump spring-boot to 3.1.0 +* Bump spring-cloud-starter-config to 4.0.3 +* Bump spring-cloud-starter-netflix-eureka-client to 4.0.2 +* Bump spring-cloud-gateway-mvc to 4.0.6 +* Bump spring-data-elasticsearch to 5.1.2 +* Bump spring-messaging to 6.0.2 +* Bump spring-security-web to 6.1.1 +* Bump spring-security-config to 6.1.1 +* Bump spring-boot-admin-starter-client to 3.1.0 +* Bump io.spring.dependency-management to 1.1.0 +* Bump io.freefair.lombok to 8.0.1 +* Bump io.freefair.maven-publish-java to 8.0.1 +* Bump org.owasp.dependencycheck to 8.3.1 +* Bump net.researchgate.release to 3.0.2 +* Bump com.gorylenko.gradle-git-properties to 2.4.1 +* Bump javers-core to 7.0.0 +* Bump httpclient to 4.5.14 +* Bump postgresql to 42.6.0 +* Bump spring-restdocs-mockmvc to 3.0.0 +* Bump mockito-inline to 5.2.0 +* Bump repo-core to 1.2.1 +* Bump service-base to 1.2.0 ## [1.4.0] - 2023-03-17 diff --git a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java index 39b1e045..4c211f85 100644 --- a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java +++ b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java @@ -19,20 +19,32 @@ import java.lang.reflect.Field; import java.lang.reflect.InaccessibleObjectException; import java.util.Set; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** + * Helper class for generic entity operations, e.g., for cleanup. * * @author jejkal */ public class EntityUtils { + private final static Logger LOGGER = LoggerFactory.getLogger(EntityUtils.class); + + /** + * Remove user-provided ids from the provided object. This is required at + * creation time as fields annotated as jakarta.persistence.Id are assigned + * by the database and conflicts with existing entities is not checked at + * inititial persisting. This method will check the provided object + * recursively, such that also child entities are processed. + * + * @param originalObj The object to check. + */ public static void removeIds(Object originalObj) { if (originalObj == null) { - System.out.println("NULL!"); return; } for (Field field : originalObj.getClass().getDeclaredFields()) { - System.out.println("NEW FIELD " + field); Id idField = field.getAnnotation(Id.class); if (idField != null) { //field is id field @@ -40,12 +52,12 @@ public static void removeIds(Object originalObj) { try { if (field.get(originalObj) != null) { //id field is set - System.out.println("REMOVE ID " + field); + LOGGER.trace("Removing user-provided id from field {}.", field); field.set(originalObj, null); } } catch (IllegalArgumentException | IllegalAccessException ex) { //update failed - System.out.println("NO ACCESS"); + LOGGER.error("Failed to enable access to field " + field + ".", ex); } } else if (Set.class.isAssignableFrom(field.getType())) { field.setAccessible(true); @@ -58,7 +70,7 @@ public static void removeIds(Object originalObj) { } } catch (IllegalArgumentException | IllegalAccessException ex) { //update failed - System.out.println("NO ACCESS"); + LOGGER.error("Failed to enable access to field " + field + ".", ex); } } else if (!field.getType().isPrimitive() && !field.getType().isEnum() && field.getType().getPackageName().startsWith("edu.kit.datamanager")) { try { @@ -69,7 +81,7 @@ public static void removeIds(Object originalObj) { } } catch (IllegalArgumentException | IllegalAccessException | InaccessibleObjectException ex) { //update failed - System.out.println("NO ACCESS"); + LOGGER.error("Failed to enable access to field " + field + ".", ex); } } } From fb1b4870ca52dcdcf6797ee24b27ef9d203b81cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:48:19 +0000 Subject: [PATCH 14/49] Bump com.h2database:h2 from 2.1.214 to 2.2.224 Bumps [com.h2database:h2](https://github.com/h2database/h2database) from 2.1.214 to 2.2.224. - [Release notes](https://github.com/h2database/h2database/releases) - [Commits](https://github.com/h2database/h2database/compare/version-2.1.214...version-2.2.224) --- updated-dependencies: - dependency-name: com.h2database:h2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5ce465a1..cfaf8ecf 100644 --- a/build.gradle +++ b/build.gradle @@ -101,7 +101,7 @@ dependencies { // driver for postgres implementation "org.postgresql:postgresql:42.6.0" //driver for h2 - implementation "com.h2database:h2:2.1.214" + implementation "com.h2database:h2:2.2.224" testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc:3.0.0" testImplementation "org.springframework.boot:spring-boot-starter-test" From 5224b9e6d2a389a78d425d7c62d946e689c07934 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:34:10 +0000 Subject: [PATCH 15/49] Bump de.codecentric:spring-boot-admin-starter-client from 3.1.0 to 3.1.7 Bumps [de.codecentric:spring-boot-admin-starter-client](https://github.com/codecentric/spring-boot-admin) from 3.1.0 to 3.1.7. - [Release notes](https://github.com/codecentric/spring-boot-admin/releases) - [Commits](https://github.com/codecentric/spring-boot-admin/compare/3.1.0...3.1.7) --- updated-dependencies: - dependency-name: de.codecentric:spring-boot-admin-starter-client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5ce465a1..a3dd02b2 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ dependencies { implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.3" implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.2" implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.0.6" - implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.0' + implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.7' // springdoc From 0b353d115ed67d7de18cc7d749e8e4724783cd20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:16:39 +0000 Subject: [PATCH 16/49] Bump com.nimbusds:nimbus-jose-jwt from 9.24.3 to 9.37 Bumps [com.nimbusds:nimbus-jose-jwt](https://bitbucket.org/connect2id/nimbus-jose-jwt) from 9.24.3 to 9.37. - [Changelog](https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/CHANGELOG.txt) - [Commits](https://bitbucket.org/connect2id/nimbus-jose-jwt/branches/compare/9.37..9.24.3) --- updated-dependencies: - dependency-name: com.nimbusds:nimbus-jose-jwt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5ce465a1..3af57225 100644 --- a/build.gradle +++ b/build.gradle @@ -84,7 +84,7 @@ dependencies { //Keycloak // implementation "org.keycloak:keycloak-spring-boot-starter:${keycloakVersion}" - implementation "com.nimbusds:nimbus-jose-jwt:9.24.3" + implementation "com.nimbusds:nimbus-jose-jwt:9.37" // implementation "io.jsonwebtoken:jjwt-api:0.11.5" //implementation "io.jsonwebtoken:jjwt-impl:0.11.5" //implementation "io.jsonwebtoken:jjwt-jackson:0.11.5" From 6d0bdb110dbf59b15035587a2bfa6d8c96165a69 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Thu, 19 Oct 2023 11:32:03 +0200 Subject: [PATCH 17/49] Create INTERFACE.md --- INTERFACE.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 INTERFACE.md diff --git a/INTERFACE.md b/INTERFACE.md new file mode 100644 index 00000000..654e125e --- /dev/null +++ b/INTERFACE.md @@ -0,0 +1,83 @@ +# Interfaces Overview for base-repo + +This document aims to answer questions on how to configure external dependencies and which public interfaces are offered by base-repo in a comprehensive way. +It is meant to be used for getting an overview and guidance in addition to the official documentation, which is available at the official [base-repo Web page](https://kit-data-manager.github.io/webpage/base-repo/). + +> **Note:** +> This document applies to the base-repo version it is shipped with. If you have a specific version running, please refer to `INTERFACE.md` of this particular release. + +## External Dependencies + +External dependencies are third-party services that are required for base-repo to work properly or that can be added optionally to provide additional functionality. Typically, external dependencies require +additional software to be installed and configured, before they can be included in the base-repo configuration, which is typically done via the main configuration file `application.properties`. + +### Relational Database (mandatory) +A relational database is required by base-repo to store administrative metadata for resources and content information. If not configured properly, base-repo will fail to start. + +#### Configuration: + - H2 In-Memory (driver included, used for testing, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/src/test/resources/test-config/application-test.properties#L31-L34) + - H2 File-Based (driver included, used for basic Docker setup, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-docker.properties#L17C1-L24) + - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) + +> **Note**: +> Other relational databases, e.g., MariaDB, SQLite, or Oracle, may also work but require additional actions. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` +> and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer +> to the driver documentation for details. + +#### Local Filesystem (mandatory) +Access to the local filesystem is required by base-repo to store and manage uploaded data. base-repo only needs access to a single folder, which can be located on the local hard drive or mounted, e.g., via NFS. + +#### Configuration: + - see `application.properties` [Documentation1](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L137-L139), [Documentation2](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L154-L165) + +### Messaging (optional) +AMQP-based messaging is an optional feature of base-repo, which allows base-repo to emit messages about creation, modification, and deletion events related to resources and content information. These messages can be received by registered consumers and processed in an asynchronous way. + +#### Configuration: + - RabbitMQ (dependencies included, requires a running RabbitMQ server) [RabbitMQ](https://www.rabbitmq.com/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/messaging-configuration.html) + +### Enhanced Search (optional) +By default, base-repo offers basic search via RESTful API by example document or certain query parameters. Optionally, enhanced search via a search index can be enabled and used for fine-grained and facetted search operations. + +#### Configuration: + - Elasticsearch (serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) + +### Access Control (optional) +By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via +JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. + +#### Configuration: + - Keycloak (serves as identity provider, requires a running Keycloak server) [Keycloak](https://www.keycloak.org/), [Documentation (TODO)](), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L192-L201) + +## Public Interfaces + +Public Interfaces are used to access base-repo in order to obtain its contents, typically this happens via HTTP/REST. Depending on the interface, special clients or protocols must be used to access a specific public interface. + +### HTTP / REST +The default way to access base-repo is via RESTful interfaces. They allow to create, update, and delete resources and content information, as well as upload and download data. + +#### Documentation + - [OpenAPI](https://kit-data-manager.github.io/webpage/base-repo/documentation/api-docs.html) + - [Usage with Examples](https://kit-data-manager.github.io/webpage/base-repo/documentation/index.html) + + + - Services known to connect to this interface: + - Scripts (not available, yet) + - Frontends (tAkita, frontend-collection/repo-management.html) + - Webcomponent for rendering single ressources (not available, yet) + - ... +- Elasticsearch Tunnel + - A REST entpoint which tunnels all requests to the connected Elasticsearch instance. Part of the HTTP / REST interface. + - Documentation: (https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) + - Services known to connect to this interface: + - frontend-collection/elastic-search-base-repo.html +- OAI-PMH + - A XML-based interface for metadata harvesting implemented the full standard. + - Source Code: https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin + - Setup: https://github.com/kit-data-manager/base-repo#enhanced-startup + - Disclaimer: not tested for a long time, might be outdated/broken +- DOIP + - A DOIP over TCP/IP implementation available as plugin. DOIP is a protocol sometimes used in the context of FAIR Digital Objects. + - Source Code: https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin + - Setup: https://github.com/kit-data-manager/base-repo#enhanced-startup + - Disclaimer: not tested for a long time, might be outdated/broken From 41e46e3c22d1514344a2661c10e6c6b0fb90f39c Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Thu, 19 Oct 2023 15:07:26 +0200 Subject: [PATCH 18/49] Update INTERFACE.md --- INTERFACE.md | 81 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 654e125e..e5a3aa83 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -15,39 +15,38 @@ additional software to be installed and configured, before they can be included A relational database is required by base-repo to store administrative metadata for resources and content information. If not configured properly, base-repo will fail to start. #### Configuration: - - H2 In-Memory (driver included, used for testing, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/src/test/resources/test-config/application-test.properties#L31-L34) - - H2 File-Based (driver included, used for basic Docker setup, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-docker.properties#L17C1-L24) - - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) + - H2 In-Memory (driver included, used for testing, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/src/test/resources/test-config/application-test.properties#L31-L34) + - H2 File-Based (driver included, used for basic Docker setup, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-docker.properties#L17C1-L24) + - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) > **Note**: > Other relational databases, e.g., MariaDB, SQLite, or Oracle, may also work but require additional actions. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` > and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer > to the driver documentation for details. -#### Local Filesystem (mandatory) +### Local Filesystem (mandatory) Access to the local filesystem is required by base-repo to store and manage uploaded data. base-repo only needs access to a single folder, which can be located on the local hard drive or mounted, e.g., via NFS. #### Configuration: - - see `application.properties` [Documentation1](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L137-L139), [Documentation2](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L154-L165) + - see `application.properties` [Documentation1](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L137-L139), [Documentation2](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L154-L165) ### Messaging (optional) AMQP-based messaging is an optional feature of base-repo, which allows base-repo to emit messages about creation, modification, and deletion events related to resources and content information. These messages can be received by registered consumers and processed in an asynchronous way. #### Configuration: - - RabbitMQ (dependencies included, requires a running RabbitMQ server) [RabbitMQ](https://www.rabbitmq.com/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/messaging-configuration.html) + - RabbitMQ (dependencies included, serves as messaging distributor, requires a running RabbitMQ server) [RabbitMQ](https://www.rabbitmq.com/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/messaging-configuration.html) ### Enhanced Search (optional) By default, base-repo offers basic search via RESTful API by example document or certain query parameters. Optionally, enhanced search via a search index can be enabled and used for fine-grained and facetted search operations. #### Configuration: - - Elasticsearch (serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) + - Elasticsearch (dependencies included, serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) ### Access Control (optional) -By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via -JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. +By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. #### Configuration: - - Keycloak (serves as identity provider, requires a running Keycloak server) [Keycloak](https://www.keycloak.org/), [Documentation (TODO)](), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L192-L201) + - Keycloak (dependencies included, serves as identity provider, requires a running Keycloak server) [Keycloak](https://www.keycloak.org/), [Documentation (TODO)](), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L192-L201) ## Public Interfaces @@ -57,27 +56,45 @@ Public Interfaces are used to access base-repo in order to obtain its contents, The default way to access base-repo is via RESTful interfaces. They allow to create, update, and delete resources and content information, as well as upload and download data. #### Documentation - - [OpenAPI](https://kit-data-manager.github.io/webpage/base-repo/documentation/api-docs.html) - - [Usage with Examples](https://kit-data-manager.github.io/webpage/base-repo/documentation/index.html) + - [OpenAPI](https://kit-data-manager.github.io/webpage/base-repo/documentation/api-docs.html) + - [Usage with Examples](https://kit-data-manager.github.io/webpage/base-repo/documentation/index.html) +#### Application Examples + - Scripts + - Graphical frontends ([frontend-collection/repo-management.html](https://github.com/kit-data-manager/frontend-collection)) - - Services known to connect to this interface: - - Scripts (not available, yet) - - Frontends (tAkita, frontend-collection/repo-management.html) - - Webcomponent for rendering single ressources (not available, yet) - - ... -- Elasticsearch Tunnel - - A REST entpoint which tunnels all requests to the connected Elasticsearch instance. Part of the HTTP / REST interface. - - Documentation: (https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) - - Services known to connect to this interface: - - frontend-collection/elastic-search-base-repo.html -- OAI-PMH - - A XML-based interface for metadata harvesting implemented the full standard. - - Source Code: https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin - - Setup: https://github.com/kit-data-manager/base-repo#enhanced-startup - - Disclaimer: not tested for a long time, might be outdated/broken -- DOIP - - A DOIP over TCP/IP implementation available as plugin. DOIP is a protocol sometimes used in the context of FAIR Digital Objects. - - Source Code: https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin - - Setup: https://github.com/kit-data-manager/base-repo#enhanced-startup - - Disclaimer: not tested for a long time, might be outdated/broken +### Elasticsearch Proxy +If 'Enhanced Search' is enabled, an additional REST endpoint becomes available, which allows to tunnel search queries to the underlying Elasticsearch instance. The advantage for proxying Elasticsearch access is, that access restrictions enabled via 'Access Control' are included in the query such that only results accessible by the caller are returned. + +#### Documentation + - [Search Configuration](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) + +#### Application Examples + - Scripts + - Graphical frontends ([frontend-collection/elastic-search-base-repo.html](https://github.com/kit-data-manager/frontend-collection)) + +### OAI-PMH +[OAI-PMH](https://www.openarchives.org/pmh/) is a standardized harvesting protocol that allows to build up external search indices that can be kept up to data by regular harvesting changes from an OAI-PMH source. For base-repo, OAI-PMH functionality can be optionally added via plugin. + +#### Source Code + - [OAI-PMH-Controller-Plugin](https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin) + +#### Documentation + - [Plugin Configuration](https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin) + - [base-repo Integration](https://github.com/kit-data-manager/base-repo#enhanced-startup) + +> **Note:** +> Currently, the plugin is only available from an internal repository, which will change in near future. Furthermore, the plugin might not work with the current version of base-repo, but will be revised as soon as it becomes publicly available. + +### Digital Object Interface Protocol (DOIP) +[DOIP](https://www.dona.net/sites/default/files/2018-11/DOIPv2Spec_1.pdf) is a novel protocol to provide generic access to digital resources. Instead of using HTTP-based communication, the protocol acts directly on top of TCP/IP and is therefore mainly relevant for special ecosystems. + +#### Source Code + - [DOIP-Plugin](https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin) + +#### Documentation + - [Plugin Configuration](https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin) + - [base-repo Integration](https://github.com/kit-data-manager/base-repo#enhanced-startup) + +> **Note:** +> Currently, the plugin is only available from an internal repository, which will change in near future. Furthermore, the plugin might not work with the current version of base-repo, but will be revised as soon as it becomes publicly available. From 13cde44f964b9a3d879f852d36093a6b356b7025 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Fri, 20 Oct 2023 09:07:24 +0200 Subject: [PATCH 19/49] Update INTERFACE.md --- INTERFACE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INTERFACE.md b/INTERFACE.md index e5a3aa83..2bd8c679 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -64,7 +64,7 @@ The default way to access base-repo is via RESTful interfaces. They allow to cre - Graphical frontends ([frontend-collection/repo-management.html](https://github.com/kit-data-manager/frontend-collection)) ### Elasticsearch Proxy -If 'Enhanced Search' is enabled, an additional REST endpoint becomes available, which allows to tunnel search queries to the underlying Elasticsearch instance. The advantage for proxying Elasticsearch access is, that access restrictions enabled via 'Access Control' are included in the query such that only results accessible by the caller are returned. +If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST endpoint becomes available, which allows to tunnel search queries to the underlying Elasticsearch instance. The advantage for proxying Elasticsearch access is, that access restrictions enabled via [Access Control](#access-control-optional) are included in the query such that only results accessible by the caller are returned. #### Documentation - [Search Configuration](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) From a32718576795fae3408bbafbdf027bbdfab08202 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Fri, 20 Oct 2023 09:09:07 +0200 Subject: [PATCH 20/49] Update INTERFACE.md --- INTERFACE.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 2bd8c679..dd09d303 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -14,7 +14,7 @@ additional software to be installed and configured, before they can be included ### Relational Database (mandatory) A relational database is required by base-repo to store administrative metadata for resources and content information. If not configured properly, base-repo will fail to start. -#### Configuration: +#### Configuration - H2 In-Memory (driver included, used for testing, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/src/test/resources/test-config/application-test.properties#L31-L34) - H2 File-Based (driver included, used for basic Docker setup, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-docker.properties#L17C1-L24) - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) @@ -27,25 +27,25 @@ A relational database is required by base-repo to store administrative metadata ### Local Filesystem (mandatory) Access to the local filesystem is required by base-repo to store and manage uploaded data. base-repo only needs access to a single folder, which can be located on the local hard drive or mounted, e.g., via NFS. -#### Configuration: +#### Configuration - see `application.properties` [Documentation1](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L137-L139), [Documentation2](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L154-L165) ### Messaging (optional) AMQP-based messaging is an optional feature of base-repo, which allows base-repo to emit messages about creation, modification, and deletion events related to resources and content information. These messages can be received by registered consumers and processed in an asynchronous way. -#### Configuration: +#### Configuration - RabbitMQ (dependencies included, serves as messaging distributor, requires a running RabbitMQ server) [RabbitMQ](https://www.rabbitmq.com/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/messaging-configuration.html) ### Enhanced Search (optional) By default, base-repo offers basic search via RESTful API by example document or certain query parameters. Optionally, enhanced search via a search index can be enabled and used for fine-grained and facetted search operations. -#### Configuration: +#### Configuration - Elasticsearch (dependencies included, serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) ### Access Control (optional) By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. -#### Configuration: +#### Configuration - Keycloak (dependencies included, serves as identity provider, requires a running Keycloak server) [Keycloak](https://www.keycloak.org/), [Documentation (TODO)](), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L192-L201) ## Public Interfaces From 90541bb0755978d180b5cb42b1e795b4bf263e40 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Fri, 20 Oct 2023 09:10:56 +0200 Subject: [PATCH 21/49] Update INTERFACE.md --- INTERFACE.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/INTERFACE.md b/INTERFACE.md index dd09d303..6f681e77 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -6,9 +6,38 @@ It is meant to be used for getting an overview and guidance in addition to the o > **Note:** > This document applies to the base-repo version it is shipped with. If you have a specific version running, please refer to `INTERFACE.md` of this particular release. +## TOC + +- [Interfaces Overview for base-repo](#interfaces-overview-for-base-repo) + * [External Dependencies](#external-dependencies) + + [Relational Database (mandatory)](#relational-database-mandatory) + - [Configuration](#configuration) + + [Local Filesystem (mandatory)](#local-filesystem-mandatory) + - [Configuration](#configuration-1) + + [Messaging (optional)](#messaging-optional) + - [Configuration](#configuration-2) + + [Enhanced Search (optional)](#enhanced-search-optional) + - [Configuration](#configuration-3) + + [Access Control (optional)](#access-control-optional) + - [Configuration](#configuration-4) + * [Public Interfaces](#public-interfaces) + + [HTTP / REST](#http--rest) + - [Documentation](#documentation) + - [Application Examples ](#application-examples) + + [Elasticsearch Proxy](#elasticsearch-proxy) + - [Documentation](#documentation-1) + - [Application Examples](#application-examples-1) + + [OAI-PMH](#oai-pmh) + - [Source Code](#source-code) + - [Documentation](#documentation-2) + + [Digital Object Interface Protocol (DOIP)](#digital-object-interface-protocol-doip) + - [Source Code](#source-code-1) + - [Documentation](#documentation-3) + + ## External Dependencies -External dependencies are third-party services that are required for base-repo to work properly or that can be added optionally to provide additional functionality. Typically, external dependencies require +External dependencies are third-party services that Qare required for base-repo to work properly or that can be added optionally to provide additional functionality. Typically, external dependencies require additional software to be installed and configured, before they can be included in the base-repo configuration, which is typically done via the main configuration file `application.properties`. ### Relational Database (mandatory) From c0e9ed6832585a08eeba152095a9f7988240983d Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Fri, 20 Oct 2023 10:51:20 +0200 Subject: [PATCH 22/49] Shrink TOC and add some Emojis --- INTERFACE.md | 75 ++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 6f681e77..3a384dd9 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -9,93 +9,80 @@ It is meant to be used for getting an overview and guidance in addition to the o ## TOC - [Interfaces Overview for base-repo](#interfaces-overview-for-base-repo) - * [External Dependencies](#external-dependencies) - + [Relational Database (mandatory)](#relational-database-mandatory) - - [Configuration](#configuration) - + [Local Filesystem (mandatory)](#local-filesystem-mandatory) - - [Configuration](#configuration-1) - + [Messaging (optional)](#messaging-optional) - - [Configuration](#configuration-2) - + [Enhanced Search (optional)](#enhanced-search-optional) - - [Configuration](#configuration-3) - + [Access Control (optional)](#access-control-optional) - - [Configuration](#configuration-4) - * [Public Interfaces](#public-interfaces) + * [External Dependencies](#external-dependencies) 📤 + + [Relational Database (mandatory)](#relational-database-mandatory) ⛁ + + [Local Filesystem (mandatory)](#local-filesystem-mandatory) 📁 + + [Messaging (optional)](#messaging-optional) đŸ’Ŧ + + [Enhanced Search (optional)](#enhanced-search-optional) 🔍 + + [Access Control (optional)](#access-control-optional) 🔐 + * [Public Interfaces](#public-interfaces) đŸ“Ĩ + [HTTP / REST](#http--rest) - - [Documentation](#documentation) - - [Application Examples ](#application-examples) - + [Elasticsearch Proxy](#elasticsearch-proxy) - - [Documentation](#documentation-1) - - [Application Examples](#application-examples-1) + + [Elasticsearch Proxy](#elasticsearch-proxy) 🔍 + [OAI-PMH](#oai-pmh) - - [Source Code](#source-code) - - [Documentation](#documentation-2) + [Digital Object Interface Protocol (DOIP)](#digital-object-interface-protocol-doip) - - [Source Code](#source-code-1) - - [Documentation](#documentation-3) -## External Dependencies +## External Dependencies 📤 External dependencies are third-party services that Qare required for base-repo to work properly or that can be added optionally to provide additional functionality. Typically, external dependencies require additional software to be installed and configured, before they can be included in the base-repo configuration, which is typically done via the main configuration file `application.properties`. -### Relational Database (mandatory) +### Relational Database (mandatory) ⛁ A relational database is required by base-repo to store administrative metadata for resources and content information. If not configured properly, base-repo will fail to start. -#### Configuration +#### Configuration ⚙ī¸ - H2 In-Memory (driver included, used for testing, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/src/test/resources/test-config/application-test.properties#L31-L34) - H2 File-Based (driver included, used for basic Docker setup, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-docker.properties#L17C1-L24) - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) -> **Note**: +> **Note**: ℹī¸ > Other relational databases, e.g., MariaDB, SQLite, or Oracle, may also work but require additional actions. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` > and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer > to the driver documentation for details. -### Local Filesystem (mandatory) +### Local Filesystem (mandatory) 📁 Access to the local filesystem is required by base-repo to store and manage uploaded data. base-repo only needs access to a single folder, which can be located on the local hard drive or mounted, e.g., via NFS. -#### Configuration +#### Configuration ⚙ī¸ - see `application.properties` [Documentation1](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L137-L139), [Documentation2](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L154-L165) -### Messaging (optional) +### Messaging (optional) đŸ’Ŧ AMQP-based messaging is an optional feature of base-repo, which allows base-repo to emit messages about creation, modification, and deletion events related to resources and content information. These messages can be received by registered consumers and processed in an asynchronous way. -#### Configuration +#### Configuration ⚙ī¸ - RabbitMQ (dependencies included, serves as messaging distributor, requires a running RabbitMQ server) [RabbitMQ](https://www.rabbitmq.com/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/messaging-configuration.html) -### Enhanced Search (optional) +### Enhanced Search (optional) 🔍 By default, base-repo offers basic search via RESTful API by example document or certain query parameters. Optionally, enhanced search via a search index can be enabled and used for fine-grained and facetted search operations. -#### Configuration +#### Configuration 🔧 - Elasticsearch (dependencies included, serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) -### Access Control (optional) +### Access Control (optional) 🔐 By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. -#### Configuration +#### Configuration 🔧 - Keycloak (dependencies included, serves as identity provider, requires a running Keycloak server) [Keycloak](https://www.keycloak.org/), [Documentation (TODO)](), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L192-L201) -## Public Interfaces +## Public Interfaces đŸ“Ĩ Public Interfaces are used to access base-repo in order to obtain its contents, typically this happens via HTTP/REST. Depending on the interface, special clients or protocols must be used to access a specific public interface. ### HTTP / REST The default way to access base-repo is via RESTful interfaces. They allow to create, update, and delete resources and content information, as well as upload and download data. -#### Documentation +#### Documentation 📖 - [OpenAPI](https://kit-data-manager.github.io/webpage/base-repo/documentation/api-docs.html) - [Usage with Examples](https://kit-data-manager.github.io/webpage/base-repo/documentation/index.html) -#### Application Examples +#### Application Examples 📋 - Scripts - Graphical frontends ([frontend-collection/repo-management.html](https://github.com/kit-data-manager/frontend-collection)) -### Elasticsearch Proxy +### Elasticsearch Proxy 🔍 If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST endpoint becomes available, which allows to tunnel search queries to the underlying Elasticsearch instance. The advantage for proxying Elasticsearch access is, that access restrictions enabled via [Access Control](#access-control-optional) are included in the query such that only results accessible by the caller are returned. -#### Documentation +#### Documentation 📖 - [Search Configuration](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) #### Application Examples @@ -105,25 +92,25 @@ If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST e ### OAI-PMH [OAI-PMH](https://www.openarchives.org/pmh/) is a standardized harvesting protocol that allows to build up external search indices that can be kept up to data by regular harvesting changes from an OAI-PMH source. For base-repo, OAI-PMH functionality can be optionally added via plugin. -#### Source Code +#### Source Code 📋 - [OAI-PMH-Controller-Plugin](https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin) -#### Documentation +#### Documentation 📖 - [Plugin Configuration](https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin) - [base-repo Integration](https://github.com/kit-data-manager/base-repo#enhanced-startup) -> **Note:** +> **Note:** ℹī¸ > Currently, the plugin is only available from an internal repository, which will change in near future. Furthermore, the plugin might not work with the current version of base-repo, but will be revised as soon as it becomes publicly available. ### Digital Object Interface Protocol (DOIP) [DOIP](https://www.dona.net/sites/default/files/2018-11/DOIPv2Spec_1.pdf) is a novel protocol to provide generic access to digital resources. Instead of using HTTP-based communication, the protocol acts directly on top of TCP/IP and is therefore mainly relevant for special ecosystems. -#### Source Code +#### Source Code 📋 - [DOIP-Plugin](https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin) -#### Documentation +#### Documentation 📖 - [Plugin Configuration](https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin) - [base-repo Integration](https://github.com/kit-data-manager/base-repo#enhanced-startup) -> **Note:** +> **Note:** ℹī¸ > Currently, the plugin is only available from an internal repository, which will change in near future. Furthermore, the plugin might not work with the current version of base-repo, but will be revised as soon as it becomes publicly available. From 392a988a576d869afc6ad555e8cfd7e042e40158 Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Fri, 20 Oct 2023 11:34:47 +0200 Subject: [PATCH 23/49] Unify emojis for 'configuration', put emoji in front of 'Note' and typo. --- INTERFACE.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 3a384dd9..2d6e4bf9 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -3,7 +3,7 @@ This document aims to answer questions on how to configure external dependencies and which public interfaces are offered by base-repo in a comprehensive way. It is meant to be used for getting an overview and guidance in addition to the official documentation, which is available at the official [base-repo Web page](https://kit-data-manager.github.io/webpage/base-repo/). -> **Note:** +> ℹī¸ **Note:** > This document applies to the base-repo version it is shipped with. If you have a specific version running, please refer to `INTERFACE.md` of this particular release. ## TOC @@ -24,7 +24,7 @@ It is meant to be used for getting an overview and guidance in addition to the o ## External Dependencies 📤 -External dependencies are third-party services that Qare required for base-repo to work properly or that can be added optionally to provide additional functionality. Typically, external dependencies require +External dependencies are third-party services that are required for base-repo to work properly or that can be added optionally to provide additional functionality. Typically, external dependencies require additional software to be installed and configured, before they can be included in the base-repo configuration, which is typically done via the main configuration file `application.properties`. ### Relational Database (mandatory) ⛁ @@ -35,7 +35,7 @@ A relational database is required by base-repo to store administrative metadata - H2 File-Based (driver included, used for basic Docker setup, not recommended for production) [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-docker.properties#L17C1-L24) - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) -> **Note**: ℹī¸ +> ℹī¸ **Note:** > Other relational databases, e.g., MariaDB, SQLite, or Oracle, may also work but require additional actions. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` > and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer > to the driver documentation for details. @@ -55,13 +55,13 @@ AMQP-based messaging is an optional feature of base-repo, which allows base-repo ### Enhanced Search (optional) 🔍 By default, base-repo offers basic search via RESTful API by example document or certain query parameters. Optionally, enhanced search via a search index can be enabled and used for fine-grained and facetted search operations. -#### Configuration 🔧 +#### Configuration ⚙ī¸ - Elasticsearch (dependencies included, serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) ### Access Control (optional) 🔐 By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. -#### Configuration 🔧 +#### Configuration ⚙ī¸ - Keycloak (dependencies included, serves as identity provider, requires a running Keycloak server) [Keycloak](https://www.keycloak.org/), [Documentation (TODO)](), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L192-L201) ## Public Interfaces đŸ“Ĩ @@ -85,7 +85,7 @@ If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST e #### Documentation 📖 - [Search Configuration](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) -#### Application Examples +#### Application Examples 📋 - Scripts - Graphical frontends ([frontend-collection/elastic-search-base-repo.html](https://github.com/kit-data-manager/frontend-collection)) @@ -99,7 +99,7 @@ If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST e - [Plugin Configuration](https://git.scc.kit.edu/kitdatamanager/2.0/oai-pmh-controller-plugin) - [base-repo Integration](https://github.com/kit-data-manager/base-repo#enhanced-startup) -> **Note:** ℹī¸ +> ℹī¸ **Note:** > Currently, the plugin is only available from an internal repository, which will change in near future. Furthermore, the plugin might not work with the current version of base-repo, but will be revised as soon as it becomes publicly available. ### Digital Object Interface Protocol (DOIP) @@ -112,5 +112,5 @@ If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST e - [Plugin Configuration](https://git.scc.kit.edu/kitdatamanager/2.0/doip-plugin) - [base-repo Integration](https://github.com/kit-data-manager/base-repo#enhanced-startup) -> **Note:** ℹī¸ +> ℹī¸ **Note:** > Currently, the plugin is only available from an internal repository, which will change in near future. Furthermore, the plugin might not work with the current version of base-repo, but will be revised as soon as it becomes publicly available. From 4969dd20e1bdd08be348e810adc9e4b626a9fddc Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Fri, 20 Oct 2023 12:05:05 +0200 Subject: [PATCH 24/49] External emojis replaced by existing ones. --- INTERFACE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 2d6e4bf9..2c4f43c0 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -11,7 +11,7 @@ It is meant to be used for getting an overview and guidance in addition to the o - [Interfaces Overview for base-repo](#interfaces-overview-for-base-repo) * [External Dependencies](#external-dependencies) 📤 + [Relational Database (mandatory)](#relational-database-mandatory) ⛁ - + [Local Filesystem (mandatory)](#local-filesystem-mandatory) 📁 + + [Local Filesystem (mandatory)](#local-filesystem-mandatory) 📂 + [Messaging (optional)](#messaging-optional) đŸ’Ŧ + [Enhanced Search (optional)](#enhanced-search-optional) 🔍 + [Access Control (optional)](#access-control-optional) 🔐 @@ -40,7 +40,7 @@ A relational database is required by base-repo to store administrative metadata > and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer > to the driver documentation for details. -### Local Filesystem (mandatory) 📁 +### Local Filesystem (mandatory) 📂 Access to the local filesystem is required by base-repo to store and manage uploaded data. base-repo only needs access to a single folder, which can be located on the local hard drive or mounted, e.g., via NFS. #### Configuration ⚙ī¸ From c0caacc58f1910fc4a6273c18cb600ad7d4a53f1 Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Fri, 20 Oct 2023 12:16:29 +0200 Subject: [PATCH 25/49] Replace messaging emoji From 36536a13a134e80084afd3ab9a85e1cd2a83bb1a Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Fri, 20 Oct 2023 15:44:37 +0200 Subject: [PATCH 26/49] Fix typos. --- INTERFACE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 6f681e77..5d7488f4 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -1,7 +1,7 @@ # Interfaces Overview for base-repo This document aims to answer questions on how to configure external dependencies and which public interfaces are offered by base-repo in a comprehensive way. -It is meant to be used for getting an overview and guidance in addition to the official documentation, which is available at the official [base-repo Web page](https://kit-data-manager.github.io/webpage/base-repo/). +It is meant to be used for getting an overview and guidance in addition to the official documentation, which is available at the official [base-repo web page](https://kit-data-manager.github.io/webpage/base-repo/). > **Note:** > This document applies to the base-repo version it is shipped with. If you have a specific version running, please refer to `INTERFACE.md` of this particular release. @@ -49,8 +49,8 @@ A relational database is required by base-repo to store administrative metadata - PostgreSQL (driver included, requires a running PostgreSQL server, used for production) [PostgreSQL](https://www.postgresql.org/), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L38-L45) > **Note**: -> Other relational databases, e.g., MariaDB, SQLite, or Oracle, may also work but require additional actions. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` -> and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer +> Other relational databases, such as MariaDB, SQLite, or Oracle, may also work, but require additional steps. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` +> and base-repo has to be compiled. Proper JDBC drivers are typically provided on the database's web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer > to the driver documentation for details. ### Local Filesystem (mandatory) From 06f0d74fbff4f7e05162aa74011e2929b72dbc67 Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Mon, 23 Oct 2023 08:52:19 +0200 Subject: [PATCH 27/49] Fix links in TOC of 'INTERFACE.md'. --- INTERFACE.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/INTERFACE.md b/INTERFACE.md index 2c4f43c0..5249a7d6 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -9,15 +9,15 @@ It is meant to be used for getting an overview and guidance in addition to the o ## TOC - [Interfaces Overview for base-repo](#interfaces-overview-for-base-repo) - * [External Dependencies](#external-dependencies) 📤 - + [Relational Database (mandatory)](#relational-database-mandatory) ⛁ - + [Local Filesystem (mandatory)](#local-filesystem-mandatory) 📂 - + [Messaging (optional)](#messaging-optional) đŸ’Ŧ - + [Enhanced Search (optional)](#enhanced-search-optional) 🔍 - + [Access Control (optional)](#access-control-optional) 🔐 - * [Public Interfaces](#public-interfaces) đŸ“Ĩ + * [External Dependencies](#external-dependencies-) 📤 + + [Relational Database (mandatory)](#relational-database-mandatory-) ⛁ + + [Local Filesystem (mandatory)](#local-filesystem-mandatory-) 📂 + + [Messaging (optional)](#messaging-optional-) đŸ’Ŧ + + [Enhanced Search (optional)](#enhanced-search-optional-) 🔍 + + [Access Control (optional)](#access-control-optional-) 🔐 + * [Public Interfaces](#public-interfaces-) đŸ“Ĩ + [HTTP / REST](#http--rest) - + [Elasticsearch Proxy](#elasticsearch-proxy) 🔍 + + [Elasticsearch Proxy](#elasticsearch-proxy-) 🔍 + [OAI-PMH](#oai-pmh) + [Digital Object Interface Protocol (DOIP)](#digital-object-interface-protocol-doip) From 9512c51afd0db369f36693a359fe99e488e2375a Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Mon, 23 Oct 2023 09:02:12 +0200 Subject: [PATCH 28/49] Fix link in INTERFACE.md --- INTERFACE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INTERFACE.md b/INTERFACE.md index 5d7488f4..d6c48dc4 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -69,7 +69,7 @@ AMQP-based messaging is an optional feature of base-repo, which allows base-repo By default, base-repo offers basic search via RESTful API by example document or certain query parameters. Optionally, enhanced search via a search index can be enabled and used for fine-grained and facetted search operations. #### Configuration - - Elasticsearch (dependencies included, serves as seach index, requires a running Elasticsearch server) [Elasticsearch] (https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) + - Elasticsearch (dependencies included, serves as seach index, requires a running Elasticsearch server) [Elasticsearch](https://www.elastic.co/de/elasticsearch/), [Documentation](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html), [Example](https://github.com/kit-data-manager/base-repo/blob/4e90c6aeaced4715d419482f3cb127cddc85bd37/config/application-default.properties#L104-L107) ### Access Control (optional) By default, base-repo itself is open for all kinds of operations, i.e., read and write, where write access should be restricted on the user interface level, e.g., by a password-protected area for critical operations. Optionally, authentication and authorization via JSON Web Tokens (JWT) issued by a Keycloak instance, can be configured. From ad2a18c6156a34922c4b544481d75f06062f26fb Mon Sep 17 00:00:00 2001 From: Volker Hartmann Date: Mon, 23 Oct 2023 11:30:20 +0200 Subject: [PATCH 29/49] Fix two more links in INTERFACE.md --- INTERFACE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INTERFACE.md b/INTERFACE.md index 5249a7d6..55295f3d 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -80,7 +80,7 @@ The default way to access base-repo is via RESTful interfaces. They allow to cre - Graphical frontends ([frontend-collection/repo-management.html](https://github.com/kit-data-manager/frontend-collection)) ### Elasticsearch Proxy 🔍 -If [Enhanced Search](#enhanced-search-optional) is enabled, an additional REST endpoint becomes available, which allows to tunnel search queries to the underlying Elasticsearch instance. The advantage for proxying Elasticsearch access is, that access restrictions enabled via [Access Control](#access-control-optional) are included in the query such that only results accessible by the caller are returned. +If [Enhanced Search](#enhanced-search-optional-) is enabled, an additional REST endpoint becomes available, which allows to tunnel search queries to the underlying Elasticsearch instance. The advantage for proxying Elasticsearch access is, that access restrictions enabled via [Access Control](#access-control-optional-) are included in the query such that only results accessible by the caller are returned. #### Documentation 📖 - [Search Configuration](https://kit-data-manager.github.io/webpage/base-repo/documentation/search-configuration.html) From 742f51452d72276b620497dd8402bc11ee76d1cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 22:55:06 +0000 Subject: [PATCH 30/49] Bump org.springframework.boot from 3.1.0 to 3.1.5 Bumps [org.springframework.boot](https://github.com/spring-projects/spring-boot) from 3.1.0 to 3.1.5. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.1.0...v3.1.5) --- updated-dependencies: - dependency-name: org.springframework.boot dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5ce465a1..8516e5c8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.springframework.boot' version '3.1.0' + id 'org.springframework.boot' version '3.1.5' id 'io.spring.dependency-management' version '1.1.0' id 'io.freefair.lombok' version '8.0.1' id 'io.freefair.maven-publish-java' version '8.0.1' From 384ca7585e5fb1d928a3395adef15b8e867541ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:32:36 +0000 Subject: [PATCH 31/49] Bump org.springframework:spring-messaging from 6.0.2 to 6.0.13 Bumps [org.springframework:spring-messaging](https://github.com/spring-projects/spring-framework) from 6.0.2 to 6.0.13. - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.2...v6.0.13) --- updated-dependencies: - dependency-name: org.springframework:spring-messaging dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f8c51cff..9d1c867f 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-actuator" implementation 'org.springframework.data:spring-data-elasticsearch:5.1.2' - implementation "org.springframework:spring-messaging:6.0.2" + implementation "org.springframework:spring-messaging:6.0.13" implementation "org.springframework.security:spring-security-web:6.1.1" implementation "org.springframework.security:spring-security-config:6.1.1" From 16b2aedcf482d5ef92f2422ab5233a2e8ed4d3d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:32:37 +0000 Subject: [PATCH 32/49] Bump org.owasp.dependencycheck from 8.3.1 to 8.4.2 Bumps org.owasp.dependencycheck from 8.3.1 to 8.4.2. --- updated-dependencies: - dependency-name: org.owasp.dependencycheck dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f8c51cff..0abc28f3 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'io.spring.dependency-management' version '1.1.0' id 'io.freefair.lombok' version '8.0.1' id 'io.freefair.maven-publish-java' version '8.0.1' - id 'org.owasp.dependencycheck' version '8.3.1' + id 'org.owasp.dependencycheck' version '8.4.2' id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'net.researchgate.release' version '3.0.2' id 'com.gorylenko.gradle-git-properties' version '2.4.1' From 449a502c80eeec77234b87beda40827b9bfc3a92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:32:41 +0000 Subject: [PATCH 33/49] Bump org.springframework.cloud:spring-cloud-starter-netflix-eureka-client Bumps [org.springframework.cloud:spring-cloud-starter-netflix-eureka-client](https://github.com/spring-cloud/spring-cloud-netflix) from 4.0.2 to 4.0.3. - [Release notes](https://github.com/spring-cloud/spring-cloud-netflix/releases) - [Commits](https://github.com/spring-cloud/spring-cloud-netflix/compare/v4.0.2...v4.0.3) --- updated-dependencies: - dependency-name: org.springframework.cloud:spring-cloud-starter-netflix-eureka-client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f8c51cff..8b7e6889 100644 --- a/build.gradle +++ b/build.gradle @@ -67,7 +67,7 @@ dependencies { // cloud support implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.3" - implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.2" + implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.3" implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.0.6" implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.7' From 5ac931786cac4d4fb8b0795a03d2fae945487b4e Mon Sep 17 00:00:00 2001 From: Philipp Ost <97529065+pjoKIT@users.noreply.github.com> Date: Wed, 15 Nov 2023 10:10:04 +0100 Subject: [PATCH 34/49] Tidy up note about relational databases in INTERFACE.md --- INTERFACE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/INTERFACE.md b/INTERFACE.md index 859da3da..18de581b 100644 --- a/INTERFACE.md +++ b/INTERFACE.md @@ -38,7 +38,6 @@ A relational database is required by base-repo to store administrative metadata > ℹī¸ **Note:** > Other relational databases, e.g., MariaDB, SQLite, or Oracle, may also work but require additional actions. To allow base-repo to connect, the source code repository must be cloned, an appropriate JDBC driver has to be added to `build.gradle` > and base-repo has be be compiled. Proper JDBC drivers are typically provided on the database's Web page. Afterwards, the database can be configured in `application.properties` similar to PostgreSQL but with database-specific property naming. Please refer - > to the driver documentation for details. ### Local Filesystem (mandatory) 📂 From d5c866e6b69335ec28a764262f151a326cf43fbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:56:55 +0000 Subject: [PATCH 35/49] Bump org.springframework.security:spring-security-config Bumps [org.springframework.security:spring-security-config](https://github.com/spring-projects/spring-security) from 6.1.1 to 6.1.5. - [Release notes](https://github.com/spring-projects/spring-security/releases) - [Changelog](https://github.com/spring-projects/spring-security/blob/main/RELEASE.adoc) - [Commits](https://github.com/spring-projects/spring-security/compare/6.1.1...6.1.5) --- updated-dependencies: - dependency-name: org.springframework.security:spring-security-config dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1fe5857f..eddd35f3 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ dependencies { implementation "org.springframework:spring-messaging:6.0.13" implementation "org.springframework.security:spring-security-web:6.1.1" - implementation "org.springframework.security:spring-security-config:6.1.1" + implementation "org.springframework.security:spring-security-config:6.1.5" // cloud support implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.3" From 8579cc451d762fef7963de02b112a3b971d1c4ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:57:14 +0000 Subject: [PATCH 36/49] Bump org.springframework.data:spring-data-elasticsearch Bumps [org.springframework.data:spring-data-elasticsearch](https://github.com/spring-projects/spring-data-elasticsearch) from 5.1.2 to 5.2.0. - [Release notes](https://github.com/spring-projects/spring-data-elasticsearch/releases) - [Commits](https://github.com/spring-projects/spring-data-elasticsearch/compare/5.1.2...5.2.0) --- updated-dependencies: - dependency-name: org.springframework.data:spring-data-elasticsearch dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1fe5857f..0d3a1d34 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-data-rest" implementation "org.springframework.boot:spring-boot-starter-mail" implementation "org.springframework.boot:spring-boot-starter-actuator" - implementation 'org.springframework.data:spring-data-elasticsearch:5.1.2' + implementation 'org.springframework.data:spring-data-elasticsearch:5.2.0' implementation "org.springframework:spring-messaging:6.0.13" implementation "org.springframework.security:spring-security-web:6.1.1" From 111010ba6a8906419cbd6858ff1359c38e379059 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 22:34:04 +0000 Subject: [PATCH 37/49] Bump org.owasp.dependencycheck from 8.4.2 to 8.4.3 Bumps org.owasp.dependencycheck from 8.4.2 to 8.4.3. --- updated-dependencies: - dependency-name: org.owasp.dependencycheck dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e86b7ae6..b8e34a3c 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'io.spring.dependency-management' version '1.1.0' id 'io.freefair.lombok' version '8.0.1' id 'io.freefair.maven-publish-java' version '8.0.1' - id 'org.owasp.dependencycheck' version '8.4.2' + id 'org.owasp.dependencycheck' version '8.4.3' id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'net.researchgate.release' version '3.0.2' id 'com.gorylenko.gradle-git-properties' version '2.4.1' From ca4c2638c8946cdb7895c2dc6a5574440e9bb821 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 22:34:15 +0000 Subject: [PATCH 38/49] Bump org.springframework.security:spring-security-web Bumps [org.springframework.security:spring-security-web](https://github.com/spring-projects/spring-security) from 6.1.1 to 6.2.0. - [Release notes](https://github.com/spring-projects/spring-security/releases) - [Changelog](https://github.com/spring-projects/spring-security/blob/main/RELEASE.adoc) - [Commits](https://github.com/spring-projects/spring-security/compare/6.1.1...6.2.0) --- updated-dependencies: - dependency-name: org.springframework.security:spring-security-web dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e86b7ae6..0a36ae80 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ dependencies { implementation 'org.springframework.data:spring-data-elasticsearch:5.2.0' implementation "org.springframework:spring-messaging:6.0.13" - implementation "org.springframework.security:spring-security-web:6.1.1" + implementation "org.springframework.security:spring-security-web:6.2.0" implementation "org.springframework.security:spring-security-config:6.1.5" // cloud support From d041dd6c74b7279767e5f640061e992feef2b009 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 22:34:20 +0000 Subject: [PATCH 39/49] Bump de.codecentric:spring-boot-admin-starter-client from 3.1.7 to 3.1.8 Bumps [de.codecentric:spring-boot-admin-starter-client](https://github.com/codecentric/spring-boot-admin) from 3.1.7 to 3.1.8. - [Release notes](https://github.com/codecentric/spring-boot-admin/releases) - [Commits](https://github.com/codecentric/spring-boot-admin/compare/3.1.7...3.1.8) --- updated-dependencies: - dependency-name: de.codecentric:spring-boot-admin-starter-client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e86b7ae6..a8773820 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ dependencies { implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.3" implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.3" implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.0.6" - implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.7' + implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.8' // springdoc From 1bdf2363c0e845535f8dda105969859eb7346dcb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 22:34:24 +0000 Subject: [PATCH 40/49] Bump org.postgresql:postgresql from 42.6.0 to 42.7.0 Bumps [org.postgresql:postgresql](https://github.com/pgjdbc/pgjdbc) from 42.6.0 to 42.7.0. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.6.0...REL42.7.0) --- updated-dependencies: - dependency-name: org.postgresql:postgresql dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e86b7ae6..7adee378 100644 --- a/build.gradle +++ b/build.gradle @@ -99,7 +99,7 @@ dependencies { runtimeOnly "org.apache.httpcomponents:httpclient:4.5.14" // driver for postgres - implementation "org.postgresql:postgresql:42.6.0" + implementation "org.postgresql:postgresql:42.7.0" //driver for h2 implementation "com.h2database:h2:2.2.224" From ae50c2399aa5cd0503d2e2e0772bde696e966df4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 08:05:09 +0000 Subject: [PATCH 41/49] Bump org.springframework:spring-messaging from 6.0.13 to 6.1.0 Bumps [org.springframework:spring-messaging](https://github.com/spring-projects/spring-framework) from 6.0.13 to 6.1.0. - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](https://github.com/spring-projects/spring-framework/compare/v6.0.13...v6.1.0) --- updated-dependencies: - dependency-name: org.springframework:spring-messaging dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5ab035a2..368aa5e9 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-actuator" implementation 'org.springframework.data:spring-data-elasticsearch:5.2.0' - implementation "org.springframework:spring-messaging:6.0.13" + implementation "org.springframework:spring-messaging:6.1.0" implementation "org.springframework.security:spring-security-web:6.2.0" implementation "org.springframework.security:spring-security-config:6.1.5" From 660e86f89b9ea37b7c2e3a896c0e703018eecc2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 22:40:52 +0000 Subject: [PATCH 42/49] Bump org.springframework.cloud:spring-cloud-starter-config Bumps [org.springframework.cloud:spring-cloud-starter-config](https://github.com/spring-cloud/spring-cloud-config) from 4.0.3 to 4.0.4. - [Release notes](https://github.com/spring-cloud/spring-cloud-config/releases) - [Commits](https://github.com/spring-cloud/spring-cloud-config/compare/v4.0.3...v4.0.4) --- updated-dependencies: - dependency-name: org.springframework.cloud:spring-cloud-starter-config dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1d86fc7d..3c6b7d05 100644 --- a/build.gradle +++ b/build.gradle @@ -66,7 +66,7 @@ dependencies { implementation "org.springframework.security:spring-security-config:6.1.5" // cloud support - implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.3" + implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.4" implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:4.0.3" implementation "org.springframework.cloud:spring-cloud-gateway-mvc:4.0.6" implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.8' From d9f17db54ef96a4e58cb3fbbd114b923ef73f06f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 22:41:00 +0000 Subject: [PATCH 43/49] Bump io.freefair.maven-publish-java from 8.0.1 to 8.4 Bumps [io.freefair.maven-publish-java](https://github.com/freefair/gradle-plugins) from 8.0.1 to 8.4. - [Release notes](https://github.com/freefair/gradle-plugins/releases) - [Commits](https://github.com/freefair/gradle-plugins/compare/8.0.1...8.4) --- updated-dependencies: - dependency-name: io.freefair.maven-publish-java dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1d86fc7d..df7e479f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'org.springframework.boot' version '3.1.5' id 'io.spring.dependency-management' version '1.1.0' id 'io.freefair.lombok' version '8.0.1' - id 'io.freefair.maven-publish-java' version '8.0.1' + id 'io.freefair.maven-publish-java' version '8.4' id 'org.owasp.dependencycheck' version '8.4.3' id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'net.researchgate.release' version '3.0.2' From 3989fcdb7b5ec1f316946b3db8fce9018a2b3ba2 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Sat, 2 Dec 2023 12:39:06 +0100 Subject: [PATCH 44/49] Fixed elastic configuration, updated OpenAPI version number for next release --- .../configuration/ElasticConfiguration.java | 24 ++++--------------- .../configuration/OpenApiDefinitions.java | 2 +- .../repo/domain/TabulatorLocalPagination.java | 5 +++- .../datamanager/repo/util/EntityUtils.java | 13 ++++++++++ 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java b/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java index 7655aad2..461c162e 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/ElasticConfiguration.java @@ -15,30 +15,16 @@ */ package edu.kit.datamanager.repo.configuration; -import edu.kit.datamanager.configuration.SearchConfiguration; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.elasticsearch.client.ClientConfiguration; -import org.springframework.data.elasticsearch.client.elc.ElasticsearchClients; -import org.springframework.data.elasticsearch.client.elc.ElasticsearchConfiguration; -import org.springframework.data.elasticsearch.support.HttpHeaders; - /** * * @author jejkal */ -@Configuration -@ConditionalOnProperty(prefix = "repo.search", name="enabled", havingValue = "true", matchIfMissing = false) -public class ElasticConfiguration extends ElasticsearchConfiguration { +//@Configuration +//@ConditionalOnProperty(prefix = "repo.search", name="enabled", havingValue = "true", matchIfMissing = false) +public class ElasticConfiguration{// extends ElasticsearchConfiguration { - @Autowired - private SearchConfiguration searchConfiguration; - @Override + /* @Override public ClientConfiguration clientConfiguration() { // HttpHeaders httpHeaders = new HttpHeaders(); // httpHeaders.add("some-header", "on every request"); @@ -61,5 +47,5 @@ public ClientConfiguration clientConfiguration() { })) .build(); return clientConfiguration; - } + }*/ } diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/OpenApiDefinitions.java b/src/main/java/edu/kit/datamanager/repo/configuration/OpenApiDefinitions.java index 13812b93..d07e429e 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/OpenApiDefinitions.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/OpenApiDefinitions.java @@ -37,7 +37,7 @@ public OpenAPI customOpenAPI(){ .components(new Components()) .info(new Info().title("Repository Microservice - RESTful API"). description("This webpage describes the RESTful interface of the KIT Data Manager Repository Microservice."). - version("0.1"). + version("1.5.0"). contact( new Contact(). name("KIT Data Manager Support"). diff --git a/src/main/java/edu/kit/datamanager/repo/domain/TabulatorLocalPagination.java b/src/main/java/edu/kit/datamanager/repo/domain/TabulatorLocalPagination.java index 79388993..bb2de33c 100644 --- a/src/main/java/edu/kit/datamanager/repo/domain/TabulatorLocalPagination.java +++ b/src/main/java/edu/kit/datamanager/repo/domain/TabulatorLocalPagination.java @@ -15,6 +15,8 @@ */ package edu.kit.datamanager.repo.domain; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import lombok.Builder; @@ -31,6 +33,7 @@ public class TabulatorLocalPagination { @JsonProperty("last_page") private int lastPage; - + + @JsonInclude(Include.ALWAYS) private List data; } diff --git a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java index 4c211f85..1d77fd7d 100644 --- a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java +++ b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java @@ -15,9 +15,12 @@ */ package edu.kit.datamanager.repo.util; +import com.fasterxml.jackson.databind.ObjectMapper; +import edu.kit.datamanager.repo.domain.TabulatorLocalPagination; import jakarta.persistence.Id; import java.lang.reflect.Field; import java.lang.reflect.InaccessibleObjectException; +import java.util.LinkedList; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,4 +89,14 @@ public static void removeIds(Object originalObj) { } } } + + public static void main(String[] args) throws Exception{ + TabulatorLocalPagination tabulatorLocalPagination = TabulatorLocalPagination.builder() + .lastPage(0) + .data(new LinkedList<>()) + .build(); + System.out.println(new LinkedList<>()); + ObjectMapper m = new ObjectMapper(); + System.out.println(m.writeValueAsString(tabulatorLocalPagination)); + } } From a98cb5a57359ccd1dc2dc59ae15687d335be2a79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 11:40:23 +0000 Subject: [PATCH 45/49] Bump io.freefair.lombok from 8.0.1 to 8.4 Bumps [io.freefair.lombok](https://github.com/freefair/gradle-plugins) from 8.0.1 to 8.4. - [Release notes](https://github.com/freefair/gradle-plugins/releases) - [Commits](https://github.com/freefair/gradle-plugins/compare/8.0.1...8.4) --- updated-dependencies: - dependency-name: io.freefair.lombok dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index df7e479f..34d258fe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'org.springframework.boot' version '3.1.5' id 'io.spring.dependency-management' version '1.1.0' - id 'io.freefair.lombok' version '8.0.1' + id 'io.freefair.lombok' version '8.4' id 'io.freefair.maven-publish-java' version '8.4' id 'org.owasp.dependencycheck' version '8.4.3' id 'org.asciidoctor.jvm.convert' version '3.3.2' From 075bfe0fd1cabd98e731eee5cef2718f249f7f3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 11:43:11 +0000 Subject: [PATCH 46/49] Bump org.owasp.dependencycheck from 8.4.3 to 9.0.2 Bumps org.owasp.dependencycheck from 8.4.3 to 9.0.2. --- updated-dependencies: - dependency-name: org.owasp.dependencycheck dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8e80f29e..6b1b6a7d 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'io.spring.dependency-management' version '1.1.0' id 'io.freefair.lombok' version '8.4' id 'io.freefair.maven-publish-java' version '8.4' - id 'org.owasp.dependencycheck' version '8.4.3' + id 'org.owasp.dependencycheck' version '9.0.2' id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'net.researchgate.release' version '3.0.2' id 'com.gorylenko.gradle-git-properties' version '2.4.1' From 748ad661effa3df5c86a16510bc9f3d24b8b1cd5 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Sat, 2 Dec 2023 13:00:26 +0100 Subject: [PATCH 47/49] Updated spring-security to 6.2.0, fixed CORS configuration --- build.gradle | 2 +- .../repo/configuration/WebSecurityConfig.java | 35 +++++++------------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 6b1b6a7d..299b7c71 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ dependencies { implementation "org.springframework:spring-messaging:6.1.0" implementation "org.springframework.security:spring-security-web:6.2.0" - implementation "org.springframework.security:spring-security-config:6.1.5" + implementation "org.springframework.security:spring-security-config:6.2.0" // cloud support implementation "org.springframework.cloud:spring-cloud-starter-config:4.0.4" diff --git a/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java b/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java index f7ceb31d..1abbe747 100644 --- a/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java +++ b/src/main/java/edu/kit/datamanager/repo/configuration/WebSecurityConfig.java @@ -18,7 +18,7 @@ import edu.kit.datamanager.security.filter.KeycloakTokenFilter; import edu.kit.datamanager.security.filter.NoAuthenticationFilter; import edu.kit.datamanager.security.filter.PublicAuthenticationFilter; -import jakarta.servlet.Filter; +import java.util.Arrays; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +26,6 @@ import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest; import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.info.InfoEndpoint; -import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; @@ -41,8 +40,8 @@ import org.springframework.security.web.firewall.DefaultHttpFirewall; import org.springframework.security.web.firewall.HttpFirewall; import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; /** * @@ -130,25 +129,17 @@ public HttpFirewall allowUrlEncodedSlashHttpFirewall() { } @Bean - @SuppressWarnings("StringSplitter") - public FilterRegistrationBean corsFilter() { - final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - // String[] allOrigins = allowedOriginPattern.split("[ ]*,[ ]*"); - //for (String origin : allOrigins) { - // logger.info("Add origin pattern: '{}'", origin); - config.addAllowedOriginPattern("*"); // @Value: http://localhost:8080 - // } - config.addAllowedHeader("*"); - config.addAllowedMethod("*"); - config.addExposedHeader("Content-Range"); - config.addExposedHeader("ETag"); + public CorsConfigurationSource corsConfigurationSource() { + CorsConfiguration configuration = new CorsConfiguration(); + configuration.setAllowedOrigins(Arrays.asList( + "*")); + configuration.setAllowedMethods(Arrays.asList("*")); + configuration.addAllowedHeader("*"); + configuration.addExposedHeader("Content-Range"); + configuration.addExposedHeader("ETag"); - source.registerCorsConfiguration("/**", config); - FilterRegistrationBean bean; - bean = new FilterRegistrationBean<>(new CorsFilter(source)); - bean.setOrder(0); - return bean; + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", configuration); + return source; } } From 7e90888e8165d0dc039ca0c170b0a6fd67fd2529 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Sun, 3 Dec 2023 11:16:35 +0100 Subject: [PATCH 48/49] Cleanup EntityUtils.java --- .../edu/kit/datamanager/repo/util/EntityUtils.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java index 1d77fd7d..7fd2bea3 100644 --- a/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java +++ b/src/main/java/edu/kit/datamanager/repo/util/EntityUtils.java @@ -89,14 +89,4 @@ public static void removeIds(Object originalObj) { } } } - - public static void main(String[] args) throws Exception{ - TabulatorLocalPagination tabulatorLocalPagination = TabulatorLocalPagination.builder() - .lastPage(0) - .data(new LinkedList<>()) - .build(); - System.out.println(new LinkedList<>()); - ObjectMapper m = new ObjectMapper(); - System.out.println(m.writeValueAsString(tabulatorLocalPagination)); - } } From d12abcd7522ab5659d5044f8408f9bd0f1aa5c84 Mon Sep 17 00:00:00 2001 From: Thomas Jejkal Date: Sun, 3 Dec 2023 11:25:44 +0100 Subject: [PATCH 49/49] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44fb2dbc..f668fc7b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ data resource management, e.g. register DataCite-oriented metadata and upload/do In order to build this microservice you'll need: -* Java SE Development Kit 11 or higher +* Java SE Development Kit 17 or higher After obtaining the sources change to the folder where the sources are located perform the following steps: @@ -39,7 +39,7 @@ libraries and finally build the base-repo microservice itself. As a result, a fa * PostgreSQL 9.1 or higher * RabbitMQ 3.7.3 or higher (in case you want to use the messaging feature, which is recommended) -* Elastic 7.X or higher (in case you want to use the search feature) +* Elastic 8.X or higher (in case you want to use the search feature) ### Setup