mirror of
https://gitee.com/lxp135/minio-plus.git
synced 2025-12-06 17:08:26 +08:00
演示工程,传入空的用户信息默认为访客。
This commit is contained in:
parent
4971de8191
commit
fb4ed54baa
@ -1,5 +1,6 @@
|
||||
package org.liuxp.minioplus.application.common;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.liuxp.minioplus.extension.context.UserHolder;
|
||||
import org.springframework.lang.Nullable;
|
||||
@ -31,7 +32,12 @@ public class LoginUserInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, @Nonnull HttpServletResponse response, @Nonnull Object handler) {
|
||||
String userId = request.getHeader("Authorization");
|
||||
UserHolder.set(userId);
|
||||
if(CharSequenceUtil.isBlank(userId)){
|
||||
UserHolder.set("");
|
||||
}else{
|
||||
UserHolder.set(userId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user