Browse Source

未登录情况处理

tags/v2.3.0^2^2
chenjiandong 1 year ago
parent
commit
3825d9a06a
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/config/LoginUserHandler.java

+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/config/LoginUserHandler.java View File

@@ -1,5 +1,6 @@
package com.tuoheng.config;

import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tuoheng.mapper.ClientUserMapper;
@@ -35,6 +36,9 @@ public class LoginUserHandler implements HandlerMethodArgumentResolver {
// header中获取用户token
String token = request.getHeader("th-token");
String oUserJson = request.getHeader("o-user-json");
if(StringUtils.isEmpty(token) || StringUtils.isEmpty(oUserJson)){
return new LoginUser();
}
String json = EncryptUtil.decodeUTF8StringBase64(oUserJson);
JSONObject jsonObject = JSON.parseObject(json);
String username = jsonObject.getString("username");

Loading…
Cancel
Save