From d02faf7bceab5c530abf34bd974c5807ad9320cd Mon Sep 17 00:00:00 2001 From: william Date: Fri, 6 May 2022 07:43:36 -0400 Subject: [PATCH] #30 Add tests for jwt logic and group token logic --- build.gradle.kts | 4 ---- src/main/kotlin/dev/fyloz/colorrecipesexplorer/Constants.kt | 1 + .../fyloz/colorrecipesexplorer/rest/account/UserController.kt | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1325653..c9e5674 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -106,10 +106,6 @@ tasks.withType() { tasks.withType().all { kotlinOptions { jvmTarget = JavaVersion.VERSION_17.toString() - freeCompilerArgs = listOf( - "-Xopt-in=kotlin.contracts.ExperimentalContracts", - "-Xinline-classes" - ) } } diff --git a/src/main/kotlin/dev/fyloz/colorrecipesexplorer/Constants.kt b/src/main/kotlin/dev/fyloz/colorrecipesexplorer/Constants.kt index 6478c24..5bb0754 100644 --- a/src/main/kotlin/dev/fyloz/colorrecipesexplorer/Constants.kt +++ b/src/main/kotlin/dev/fyloz/colorrecipesexplorer/Constants.kt @@ -21,6 +21,7 @@ object Constants { const val LOGIN = "$BASE_PATH/account/login" const val GROUP_LOGIN = "$BASE_PATH/account/login/group" + const val LOGOUT = "$BASE_PATH/account/logout" } object CookieNames { diff --git a/src/main/kotlin/dev/fyloz/colorrecipesexplorer/rest/account/UserController.kt b/src/main/kotlin/dev/fyloz/colorrecipesexplorer/rest/account/UserController.kt index d611e82..13414d2 100644 --- a/src/main/kotlin/dev/fyloz/colorrecipesexplorer/rest/account/UserController.kt +++ b/src/main/kotlin/dev/fyloz/colorrecipesexplorer/rest/account/UserController.kt @@ -78,10 +78,10 @@ class UserController(private val userLogic: UserLogic) { } @RestController -@RequestMapping("api") +@RequestMapping(Constants.ControllerPaths.LOGOUT) @Profile("!emergency") class LogoutController(private val userLogic: UserLogic) { - @GetMapping("logout") + @GetMapping @PreAuthorize("isFullyAuthenticated()") fun logout(request: HttpServletRequest) = ok {