Skip to content

Commit

Permalink
Merge pull request #56 from virtualidentityag/tsys-release-2024-05-28
Browse files Browse the repository at this point in the history
tsys-release 2024-05-28
  • Loading branch information
tkuzynow authored May 29, 2024
2 parents 38ce73d + edf05db commit 1612219
Show file tree
Hide file tree
Showing 64 changed files with 531 additions and 785 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dockerImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup JVM
uses: actions/setup-java@v1
with:
java-version: 11.0.10
java-version: 17.0.7
java-package: jdk
architecture: x64

Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
push_to_registry:
strategy:
matrix:
registry: ["docker.pkg.github.com", "ghcr.io"]
registry: ["ghcr.io"]
needs: [test]
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup JVM
uses: actions/setup-java@v1
with:
java-version: 11.0.10
java-version: 17.0.7
java-package: jdk
architecture: x64

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM adoptopenjdk/openjdk11
FROM openjdk:17-oracle
VOLUME ["/tmp","/log"]
EXPOSE 8080
ARG JAR_FILE
Expand Down
2 changes: 0 additions & 2 deletions api/videoservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ components:
schemas:
CreateVideoCallDTO:
type: object
required:
- sessionId
properties:
sessionId:
type: integer
Expand Down
93 changes: 68 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,33 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.12</version>
<version>3.0.6</version>
<relativePath/>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<java.version>17</java.version>
<keycloak.version>17.0.0</keycloak.version>
<!-- force at least version 2.16 due to https://logging.apache.org/log4j/2.x/security.html -->
<log4j.version>2.19.0</log4j.version>
<openapi-generator-maven-plugin.version>6.2.1</openapi-generator-maven-plugin.version>
<springfox-boot-starter.version>3.0.0</springfox-boot-starter.version>
<openapi-generator-maven-plugin.version>6.6.0</openapi-generator-maven-plugin.version>

<jackson-databind-nullable.version>0.2.3</jackson-databind-nullable.version>
<spring-swagger-ui.version>2.10.0</spring-swagger-ui.version>
<spring-security-core.version>5.7.5</spring-security-core.version>

<spring-security.version>6.0.5</spring-security.version>
<ehcache.version>2.10.9.2</ehcache.version>
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<java-jwt.version>3.12.1</java-jwt.version>
<commons-lang3.version>3.11</commons-lang3.version>
<commons-collections4.version>4.4</commons-collections4.version>
<h2.version>2.1.214</h2.version>
<liquibase-core.version>4.9.1</liquibase-core.version>
<liquibase-core.version>4.23.2</liquibase-core.version>
<hibernate.validator.version>8.0.0.Final</hibernate.validator.version>
<liquibase.maven.plugin.version>4.1.1</liquibase.maven.plugin.version>
<liquibase.maven.plugin.version>4.23.2</liquibase.maven.plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

</properties>

Expand All @@ -60,13 +62,33 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>

<!-- Spring dependencies -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring-security-core.version}</version>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>


<!-- caching dependencies -->
<dependency>
<groupId>net.sf.ehcache</groupId>
Expand Down Expand Up @@ -103,19 +125,33 @@
<version>${jackson-databind-nullable.version}</version>
</dependency>

<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
</dependency>


<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.15</version>
</dependency>
<!-- SpringFox: generate YAML file from POJOs and generate documentation -->

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.4.0</version>
</dependency>

<!-- json dependencies -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220320</version>
</dependency>

<!-- SpringFox: generate YAML file from POJOs and generate documentation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox-boot-starter.version}</version>
</dependency>
<!-- Keycloak dependencies -->
<dependency>
<groupId>org.keycloak</groupId>
Expand Down Expand Up @@ -150,6 +186,12 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.maven.plugin.version}</version>
<exclusions>
<exclusion>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -206,6 +248,7 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>


<!-- Test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -215,19 +258,14 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>${spring-security.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>powermock-module-junit4</artifactId>
<groupId>org.powermock</groupId>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<version>2.0.2</version>
</dependency>
<dependency>
<artifactId>powermock-api-mockito2</artifactId>
<groupId>org.powermock</groupId>
<scope>test</scope>
<version>2.0.2</version>
</dependency>
<!-- EasyRandom -->
<dependency>
Expand Down Expand Up @@ -268,7 +306,10 @@
<version>${log4j.version}</version>
</dependency>


<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>

</dependencies>

Expand Down Expand Up @@ -311,7 +352,9 @@
<configOptions>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>/</sourceFolder>
<useSpringBoot3>true</useSpringBoot3>
</configOptions>

<inputSpec>${project.basedir}/api/videoservice.yaml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>${project.groupId}.${project.artifactId}.generated.api.controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public ResponseEntity<Object> handleNoSuchElementException(
* @param request web request
* @return response entity
*/
@Override
@NonNull
protected ResponseEntity<Object> handleHttpMessageNotReadable(
final @NonNull HttpMessageNotReadableException ex,
Expand All @@ -85,7 +84,6 @@ protected ResponseEntity<Object> handleHttpMessageNotReadable(
* @param request web request
* @return response entity
*/
@Override
@NonNull
protected ResponseEntity<Object> handleMethodArgumentNotValid(
final @NonNull MethodArgumentNotValidException ex,
Expand Down Expand Up @@ -148,7 +146,7 @@ public ResponseEntity<Object> handleInternal(
LogService.logWarning(ex);

return handleExceptionInternal(
EMPTY_EXCEPTION, null, new HttpHeaders(), ex.getStatus(), request);
EMPTY_EXCEPTION, null, new HttpHeaders(), ex.getStatusCode(), request);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@NoArgsConstructor
@Getter
@Setter
public class VideoUser {
public class AuthenticatedUser {

@NonNull private String userId;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
package de.caritas.cob.videoservice.api.authorization;

import com.google.common.collect.Lists;
import java.util.List;
import java.util.stream.Stream;
import lombok.Getter;

/** Definition of all authorities and of the role-authority-mapping. */
@Getter
public enum Authority {
CONSULTANT(UserRole.CONSULTANT, "AUTHORIZATION_CONSULTANT_DEFAULT"),
USER(UserRole.USER, "AUTHORIZATION_USER_DEFAULT"),

JITSI_TECHNICAL(UserRole.JITSI_TECHNICAL, "AUTHORIZATION_JITSI_TECHNICAL_DEFAULT");

private final UserRole role;
private final String authorityName;
private final List<String> authorities;

Authority(final UserRole role, final String authorityName) {
this.role = role;
this.authorityName = authorityName;
this.authorities = Lists.newArrayList(authorityName);
}

/**
Expand All @@ -30,12 +34,13 @@ public static Authority fromRoleName(String roleName) {
.orElse(null);
}

/**
* Returns the authority name for the given {@link Authority}.
*
* @return authority name for the given {@link Authority}
*/
public String getAuthority() {
return this.authorityName;
public static class AuthorityValue {

private AuthorityValue() {}

public static final String PREFIX = "AUTHORIZATION_";
public static final String CONSULTANT = PREFIX + "CONSULTANT_DEFAULT";
public static final String USER = PREFIX + "USER_DEFAULT";
public static final String JITSI_TECHNICAL = PREFIX + "JITSI_TECHNICAL_DEFAULT";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
@Component
public class RoleAuthorizationAuthorityMapper implements GrantedAuthoritiesMapper {

/**
* Maps all {@link Authority} definitions to the corresponding roles.
*
* @param authorities all given authorities
* @return mapped role authorities collections
*/
@Override
public Collection<? extends GrantedAuthority> mapAuthorities(
Collection<? extends GrantedAuthority> authorities) {
Expand All @@ -31,11 +25,12 @@ public Collection<? extends GrantedAuthority> mapAuthorities(
return mapAuthorities(roleNames);
}

private Set<GrantedAuthority> mapAuthorities(Set<String> roleNames) {
public Set<GrantedAuthority> mapAuthorities(Set<String> roleNames) {
return roleNames.stream()
.map(Authority::fromRoleName)
.filter(Objects::nonNull)
.map(Authority::getAuthority)
.map(Authority::getAuthorities)
.flatMap(Collection::parallelStream)
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toSet());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import de.caritas.cob.videoservice.api.tenant.TenantContext;
import de.caritas.cob.videoservice.generated.api.controller.VideocallsApi;
import io.swagger.annotations.Api;
import jakarta.validation.Valid;
import java.util.UUID;
import javax.validation.Valid;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -41,7 +41,7 @@ public class VideoController implements VideocallsApi {
*/
@Override
public ResponseEntity<VideoCallResponseDTO> createVideoCall(
@RequestHeader String rcUserId, @Valid CreateVideoCallDTO createVideoCallDto) {
@RequestHeader String rcUserId, CreateVideoCallDTO createVideoCallDto) {
var response = videoCallFacade.startVideoCall(createVideoCallDto, rcUserId);

return new ResponseEntity<>(response, HttpStatus.CREATED);
Expand Down
Loading

0 comments on commit 1612219

Please sign in to comment.