Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Zitrone44 committed Jul 30, 2024
1 parent a3d5327 commit 4d1e7d4
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 129 deletions.
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
FROM gradle:6.8.3-jdk11 AS cache-gradle
ARG GRADLE_VERSION=8.9.0-jdk21
ARG JDK_VERSION=21

FROM gradle:$GRADLE_VERSION AS cache-gradle
RUN mkdir /cache-gradle
RUN mkdir /code
ENV GRADLE_USER_HOME /cache-gradle
COPY build.gradle.kts /code
WORKDIR /code
RUN gradle clean build -i -x bootJar

FROM gradle:6.8.3-jdk11 AS build-node
FROM gradle:$GRADLE_VERSION AS build-node
COPY ./ /build
WORKDIR /build/web-gui
RUN rm -rf node_modules
RUN gradle installDist

FROM gradle:6.8.3-jdk11 AS build-gradle
FROM gradle:$GRADLE_VERSION AS build-gradle
COPY . /build/
COPY --from=cache-gradle /cache-gradle /home/gradle/.gradle
COPY --from=build-node /build/web-gui/dist/web-gui/ /build/src/main/resources/static/
WORKDIR /build/
RUN gradle dist -i -x npm_run_clean -x npm_run_build

FROM openjdk:11-jdk-slim
FROM eclipse-temurin:$JDK_VERSION
COPY --from=build-gradle /build/build/libs/digital-classroom-0.0.1-SNAPSHOT.jar /app/digital-classroom.jar
EXPOSE 8085
ENTRYPOINT ["java","-jar","/app/digital-classroom.jar"]
29 changes: 12 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.springframework.boot") version "2.5.6"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.springframework.boot") version "3.3.2"
id("io.spring.dependency-management") version "1.1.6"
idea
kotlin("jvm") version "1.4.32"
kotlin("plugin.spring") version "1.4.32"
kotlin("kapt") version "1.4.32"
kotlin("jvm") version "2.0.0"
kotlin("plugin.spring") version "2.0.0"
}

group = "de.thm.mni.ii"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
java.sourceCompatibility = JavaVersion.VERSION_21

repositories {
mavenCentral()
Expand All @@ -29,29 +28,25 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("javax.xml.bind:jaxb-api:2.3.1")
implementation("org.hibernate:hibernate-validator:6.0.16.Final")
implementation("commons-codec:commons-codec:1.15")
implementation("org.apache.commons:commons-lang3:3.12.0")
kapt("org.springframework.boot:spring-boot-configuration-processor")
implementation("org.hibernate:hibernate-validator:8.0.1.Final")
implementation("commons-codec:commons-codec:1.17.1")
implementation("org.apache.commons:commons-lang3:3.15.0")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
// Java 11 removed these Java EE modules
implementation("javax.xml.bind:jaxb-api:2.3.1")
implementation("com.sun.xml.bind:jaxb-core:2.3.0.1")
implementation("com.sun.xml.bind:jaxb-impl:2.3.2")
implementation("com.sun.xml.bind:jaxb-core:4.0.5")
implementation("com.sun.xml.bind:jaxb-impl:4.0.5")
implementation("javax.validation:validation-api:2.0.1.Final")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
jvmTarget = "21"
}
}

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.register("dist") {
dependsOn("build", "web-gui:copyWebToBackend")
}
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
org.gradle.jvmargs=-Xmx2048m
178 changes: 89 additions & 89 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SerializationConfig : WebFluxConfigurer {
fun objectMapper(): ObjectMapper {
val om = ObjectMapper()
om.registerModule(JavaTimeModule())
om.registerModule(KotlinModule())
om.registerModule(KotlinModule.Builder().build())
return om
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package de.thm.mni.ii.classroom.properties

import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import javax.validation.constraints.NotBlank

@ConfigurationProperties(prefix = "classroom")
@ConstructorBinding
data class ClassroomProperties(

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package de.thm.mni.ii.classroom.properties
import org.hibernate.validator.constraints.Length
import org.hibernate.validator.constraints.Range
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import javax.validation.constraints.NotBlank

@ConfigurationProperties(prefix = "jwt")
@ConstructorBinding
data class JwtProperties(

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package de.thm.mni.ii.classroom.properties

import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import javax.validation.constraints.NotBlank

@ConfigurationProperties(prefix = "upstream.bbb")
@ConstructorBinding
data class UpstreamBBBProperties(

@NotBlank val serviceUrl: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import de.thm.mni.ii.classroom.security.classroom.ClassroomHttpJwtSecurity
import de.thm.mni.ii.classroom.security.classroom.ClassroomHttpSessionTokenSecurity
import de.thm.mni.ii.classroom.security.downstream.DownstreamAPISecurity
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpStatus
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
import org.springframework.security.config.web.server.SecurityWebFiltersOrder
Expand All @@ -16,6 +17,7 @@ import kotlin.text.Charsets.UTF_8
/**
* Main security configuration of the digital classroom.
*/
@Configuration
@EnableWebFluxSecurity
class SecurityConfiguration(
private val classroomHttpSessionTokenSecurity: ClassroomHttpSessionTokenSecurity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ class ClassroomRSocketJwtSecurity {
return mh
}

private class JwtToAuthenticationConverter : Converter<Jwt, Mono<ClassroomAuthentication>> {
override fun convert(source: Jwt): Mono<ClassroomAuthentication> =
Mono.just(source).map {jwt: Jwt -> ClassroomAuthentication(UserCredentials(jwt.claims), jwt.tokenValue)}
}

@Bean
fun jwtToAuthenticationConverter(): Converter<Jwt, Mono<ClassroomAuthentication>> {
return Converter<Jwt, Mono<ClassroomAuthentication>> { jwt ->

fun delegateMono(jwt: Jwt): ClassroomAuthentication {
val userCredentials = UserCredentials(jwt.claims)
return ClassroomAuthentication(userCredentials, jwt.tokenValue)
}

Mono.just(jwt).map(::delegateMono)
}
return JwtToAuthenticationConverter()
}
}
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ spring:
mapping-path: /rsocket
transport: websocket
ssl.enabled: true

0 comments on commit 4d1e7d4

Please sign in to comment.