diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt index 1b2d4d8a..6959a0ec 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt @@ -1,10 +1,12 @@ package com.simiacryptus.skyenet.platform +import com.fasterxml.jackson.annotation.JsonProperty + data class User( - internal val email: String, - internal val name: String? = null, - internal val id: String? = null, - internal val picture: String? = null, + @JsonProperty("email") internal val email: String, + @JsonProperty("name") internal val name: String? = null, + @JsonProperty("id") internal val id: String? = null, + @JsonProperty("picture") internal val picture: String? = null, ) { override fun toString() = email diff --git a/webui/src/main/kotlin/com/simiacryptus/skyenet/servlet/UserInfoServlet.kt b/webui/src/main/kotlin/com/simiacryptus/skyenet/servlet/UserInfoServlet.kt index 6352e82a..6a28d23c 100644 --- a/webui/src/main/kotlin/com/simiacryptus/skyenet/servlet/UserInfoServlet.kt +++ b/webui/src/main/kotlin/com/simiacryptus/skyenet/servlet/UserInfoServlet.kt @@ -2,6 +2,7 @@ package com.simiacryptus.skyenet.servlet import com.simiacryptus.skyenet.ApplicationBase.Companion.getCookie import com.simiacryptus.skyenet.platform.ApplicationServices +import com.simiacryptus.skyenet.platform.User import com.simiacryptus.util.JsonUtil import jakarta.servlet.http.HttpServlet import jakarta.servlet.http.HttpServletRequest @@ -11,11 +12,11 @@ class UserInfoServlet : HttpServlet() { public override fun doGet(req: HttpServletRequest, resp: HttpServletResponse) { resp.contentType = "text/json" resp.status = HttpServletResponse.SC_OK - val userinfo = ApplicationServices.authenticationManager.getUser(req.getCookie()) - if (null == userinfo) { + val user: User? = ApplicationServices.authenticationManager.getUser(req.getCookie()) + if (null == user) { resp.writer.write("{}") } else { - resp.writer.write(JsonUtil.objectMapper().writeValueAsString(userinfo)) + resp.writer.write(JsonUtil.objectMapper().writeValueAsString(user)) } } } \ No newline at end of file