Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Nov 21, 2023
1 parent 1d37142 commit 282e116
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions core/src/main/kotlin/com/simiacryptus/skyenet/platform/User.kt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}
}
}

0 comments on commit 282e116

Please sign in to comment.