Add authentication

This commit is contained in:
2023-10-05 21:11:22 +08:00
parent 78de04713f
commit 8e5375ab30
24 changed files with 580 additions and 15 deletions

View File

@@ -0,0 +1,10 @@
package top.fatweb.api.util
import org.springframework.security.core.context.SecurityContextHolder
import top.fatweb.api.entity.permission.LoginUser
object WebUtil {
fun getLoginUser() = SecurityContextHolder.getContext().authentication.principal as LoginUser
fun getLoginUserId() = getLoginUser().user.id
}