🐛 Fixing a bug. 修复报表中检查token的问题

This commit is contained in:
aeizzz committed 2022-12-14 16:00:10 +08:00
1 parent 1a780fa3d4
commit d92ae7b504
2 files changed
+11 -2

No files matched your search

@@ -224,4 +224,13 @@ public class PigTokenEndpoint {
return R.ok(result);
}
@Inner
@GetMapping("/query-token")
public R queryToken(String token) {
OAuth2Authorization authorization = authorizationService.findByToken(token,OAuth2TokenType.ACCESS_TOKEN);
return R.ok(authorization);
}
}
@@ -34,7 +34,7 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
// @formatter:off
return RetOps.of(tokenService.queryToken(splitList.get(1), splitList.get(0) ,SecurityConstants.FROM_IN))
.getDataIf(RetOps.CODE_SUCCESS)
.map(o -> (String)o.get("username"))
.map(o -> (String)o.get("principalName"))
.orElse(null);
// @formatter:off
}
@@ -43,7 +43,7 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
public Map<String, Object> getUserInfo(String token) {
String username = this.getUsername(token);
Map<String, Object> map = new HashMap<>(4);
map.put("username", username);
map.put("principalName", username);
map.put("access_token", token);
// 将所有信息存放至map 解析sql会根据map的键值解析,可自定义其他值
return map;