[+] Add /me endpoint

pull/14/head
Azalea 2024-02-19 04:42:50 -05:00
parent 3da44ce604
commit 110d6c81ee
1 changed files with 4 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import icu.samnyan.aqua.net.db.AquaNetUser
import icu.samnyan.aqua.net.db.AquaNetUserRepo
import jakarta.servlet.http.HttpServletRequest
import org.springframework.security.crypto.password.PasswordEncoder
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@ -93,4 +94,7 @@ class UserRegistrar(
return mapOf("token" to token)
}
@PostMapping("/me")
suspend fun getUser(@RP token: Str) = jwt.auth(token)
}