From e00870c739a344f0cec4448f876b3ef9d0f229df Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Mon, 11 Aug 2025 08:05:24 +0200 Subject: [PATCH] fix: Extract token before usage --- .../kotlin/de/twomartens/timetable/auth/UserController.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module-server/src/main/kotlin/de/twomartens/timetable/auth/UserController.kt b/module-server/src/main/kotlin/de/twomartens/timetable/auth/UserController.kt index d3c679a..3d00ccc 100644 --- a/module-server/src/main/kotlin/de/twomartens/timetable/auth/UserController.kt +++ b/module-server/src/main/kotlin/de/twomartens/timetable/auth/UserController.kt @@ -16,7 +16,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.security.authorization.AuthorizationDeniedException import org.springframework.security.core.context.SecurityContextHolder -import org.springframework.security.oauth2.jwt.Jwt +import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken import org.springframework.web.bind.annotation.* @RestController @@ -64,8 +64,8 @@ class UserController( ]) body: User ): ResponseEntity { val authentication = SecurityContextHolder.getContext().authentication - val jwt = authentication as Jwt - val authorizedParty = jwt.getClaimAsString("azp") + val jwt = authentication as JwtAuthenticationToken + val authorizedParty = jwt.token.getClaimAsString("azp") var created = false val userIdConverted = UserId.of(NonEmptyString(userId))