|
@@ -21,10 +21,16 @@ class CurrentUserHandler : HandlerInterceptorAdapter() {
|
|
|
private val logger = LoggerFactory.getLogger(CurrentUserHandler::class.java)
|
|
|
}
|
|
|
|
|
|
- override fun preHandle(request: HttpServletRequest?, response: HttpServletResponse?, handler: Any?): Boolean {
|
|
|
+ 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!!)!!)!!)
|
|
|
+ val id = SSOUtil.getCurUserId(request)
|
|
|
+ val user = if (id == null) {
|
|
|
+ null
|
|
|
+ } else {
|
|
|
+ SysUserUtil.getById(id)
|
|
|
+ }
|
|
|
+ logger.debug("Caching Current User... ${user?.account}")
|
|
|
+ SSOUtil.TL.set(user)
|
|
|
}
|
|
|
return super.preHandle(request, response, handler)
|
|
|
}
|