|
@@ -2,6 +2,7 @@ package com.gxzc.zen.sso.aop
|
|
|
|
|
|
import com.gxzc.zen.api.util.SysUserUtil
|
|
|
import com.gxzc.zen.umps.util.SSOUtil
|
|
|
+import org.slf4j.LoggerFactory
|
|
|
import org.springframework.web.method.HandlerMethod
|
|
|
import org.springframework.web.servlet.ModelAndView
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter
|
|
@@ -16,9 +17,13 @@ import javax.servlet.http.HttpServletResponse
|
|
|
* @url https://noahlan.com
|
|
|
*/
|
|
|
class CurrentUserHandler : HandlerInterceptorAdapter() {
|
|
|
+ companion object {
|
|
|
+ private val logger = LoggerFactory.getLogger(CurrentUserHandler::class.java)
|
|
|
+ }
|
|
|
|
|
|
override fun preHandle(request: HttpServletRequest?, response: HttpServletResponse?, handler: Any?): Boolean {
|
|
|
if (handler is HandlerMethod) {
|
|
|
+ logger.debug("Caching Current User...")
|
|
|
SSOUtil.TL.set(SysUserUtil.getById(SSOUtil.getCurUserId(request!!)!!)!!)
|
|
|
}
|
|
|
return super.preHandle(request, response, handler)
|
|
@@ -26,6 +31,7 @@ class CurrentUserHandler : HandlerInterceptorAdapter() {
|
|
|
|
|
|
override fun postHandle(request: HttpServletRequest?, response: HttpServletResponse?, handler: Any?, modelAndView: ModelAndView?) {
|
|
|
if (handler is HandlerMethod) {
|
|
|
+ logger.debug("Clear Current User...")
|
|
|
SSOUtil.TL.clear()
|
|
|
}
|
|
|
super.postHandle(request, response, handler, modelAndView)
|