replace local jwt with library version

- update DeviceController to handle hlaeja jwt instead of jwtService
- update mapper sign with hlaeja jwt instead of jwtService
- add dependency for hlaeja jwt
- remove dependencies for jjwt
- remove JwtService.kt
- remove PrivateKeyProvider.kt
- remove jwt key property explanation from additional-spring-configuration-metadata.json
This commit is contained in:
2025-01-02 05:00:19 +01:00
parent 7d4ebab8f8
commit df9d2c59a4
11 changed files with 17 additions and 194 deletions

View File

@@ -4,11 +4,11 @@ import java.time.ZonedDateTime
import ltd.hlaeja.entity.DeviceEntity
import ltd.hlaeja.entity.NodeEntity
import ltd.hlaeja.entity.TypeEntity
import ltd.hlaeja.jwt.service.PrivateJwtService
import ltd.hlaeja.library.deviceRegistry.Device
import ltd.hlaeja.library.deviceRegistry.Identity
import ltd.hlaeja.library.deviceRegistry.Node
import ltd.hlaeja.library.deviceRegistry.Type
import ltd.hlaeja.service.JwtService
import org.springframework.http.HttpStatus.EXPECTATION_FAILED
import org.springframework.web.server.ResponseStatusException
@@ -40,10 +40,10 @@ fun NodeEntity.toIdentityResponse(): Identity.Response = Identity.Response(
device,
)
suspend fun DeviceEntity.toDeviceResponse(
jwtService: JwtService,
fun DeviceEntity.toDeviceResponse(
jwtService: PrivateJwtService,
): Device.Response = Device.Response(
id ?: throw ResponseStatusException(EXPECTATION_FAILED),
type,
jwtService.makeIdentity(id),
jwtService.sign("device" to id),
)