Skip to content

Commit

Permalink
Merge pull request #11 from qbicsoftware/development
Browse files Browse the repository at this point in the history
Release PR
  • Loading branch information
KochTobi authored Jun 18, 2024
2 parents a2293d2 + f2fc88a commit 85fa3dd
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
7 changes: 3 additions & 4 deletions rest-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.3.0</version>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>life.qbic.data-download</groupId>
Expand Down
12 changes: 0 additions & 12 deletions rest-api/src/main/java/deactivated.module-info.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.context.annotation.Configuration;

@Configuration
@OpenAPIDefinition(info = @Info(title = "My API", version = "v1"),
@OpenAPIDefinition(info = @Info(title = "Data Download API Documentation", version = "v1"),
security = @SecurityRequirement(name = "personal_access_token")) //globally set this
public class OpenApiConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
Expand Down Expand Up @@ -168,16 +169,17 @@ protected AclCache aclCache() {
aclAuthorizationStrategy());
}

@Bean(name="securityDataSourceProperties")
@ConfigurationProperties("qbic.access-management.datasource")
public DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
}

@Bean("securityDataSource")
public DataSource dataSource(
@Value("${qbic.access-management.datasource.url}") String url,
@Value("${qbic.access-management.datasource.username}") String name,
@Value("${qbic.access-management.datasource.password}") String password) {
var ds = new DriverManagerDataSource();
ds.setUrl(url);
ds.setUsername(name);
ds.setPassword(password);
return ds;
public DataSource dataSource() {
return dataSourceProperties()
.initializeDataSourceBuilder()
.build();
}

@Bean("idSupportingLookupStrategy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import java.io.OutputStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Optional;
import java.util.UUID;
import javax.swing.text.html.Option;
import life.qbic.data_download.measurements.api.DataFile;
import life.qbic.data_download.measurements.api.MeasurementData;
import life.qbic.data_download.measurements.api.MeasurementDataProvider;
Expand All @@ -38,6 +38,7 @@
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

@RestController
@Tag(name = "Download Endpoints", description = "Rest endpoints related to downloading data")
public class DownloadController {

private final MeasurementDataProvider measurementDataProvider;
Expand All @@ -59,7 +60,7 @@ public DownloadController(

@GetMapping(value = "/measurements/{measurementId}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Download a measurement from the given measurement identifier")
@Parameter(name = "measurementId", required = true, description = "The identifier of the measurement to download")
@Parameter(name = "measurementId", required = true, description = "The identifier of the measurement to download", example = "NGSQ0001006AO-25948529211108")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation, the measurement is retrieved asynchronously", content = @Content(schema = @Schema(implementation = Void.class))),
@ApiResponse(responseCode = "403", description = "forbidden, you do not have access to this resource", content = @Content(schema = @Schema(implementation = Void.class))),
Expand Down
8 changes: 5 additions & 3 deletions rest-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
spring.jpa.open-in-view=false

### openAPI and Swagger UI endpoints
springdoc.api-docs.enabled=true
springdoc.swagger-ui.enabled=true
springdoc.swagger-ui.tryItOutEnabled=false
# https://springdoc.org/
# https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/ <- append to springdoc.swagger-ui.
springdoc.swagger-ui.path=/swagger-ui.html
# empty supported submit methods disables try it out button
springdoc.swagger-ui.supportedSubmitMethods=[]

### Https config behind proxy
# https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/#howto.security.enable-https
Expand Down

0 comments on commit 85fa3dd

Please sign in to comment.