|
@@ -168,7 +168,6 @@ public class PigxTokenEndpoint {
|
|
|
* 令牌管理调用
|
|
|
* @param token token
|
|
|
*/
|
|
|
- @Inner
|
|
|
@DeleteMapping("/{token}")
|
|
|
public R<Boolean> removeToken(@PathVariable("token") String token) {
|
|
|
OAuth2Authorization authorization = authorizationService.findByToken(token, OAuth2TokenType.ACCESS_TOKEN);
|
|
@@ -195,15 +194,14 @@ public class PigxTokenEndpoint {
|
|
|
* @param params 分页参数
|
|
|
* @return
|
|
|
*/
|
|
|
- @Inner
|
|
|
@PostMapping("/page")
|
|
|
public R<Page<TokenVo>> tokenList(@RequestBody Map<String, Object> params) {
|
|
|
// 根据分页参数获取对应数据
|
|
|
- String key = String.format("%s::*", CacheConstants.PROJECT_OAUTH_ACCESS);
|
|
|
+ String key = String.format("%s::%s::*", tenantKeyStrResolver.key(), CacheConstants.PROJECT_OAUTH_ACCESS);
|
|
|
int current = MapUtil.getInt(params, CommonConstants.CURRENT);
|
|
|
int size = MapUtil.getInt(params, CommonConstants.SIZE);
|
|
|
Set<String> keys = redisTemplate.keys(key);
|
|
|
- List<String> pages = keys.stream().skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
|
|
|
+ List<String> pages = keys.stream().skip((current - 1) * size).limit(size).collect(Collectors.toList());
|
|
|
Page<TokenVo> result = new Page(current, size);
|
|
|
|
|
|
List<TokenVo> tokenVoList = redisTemplate.opsForValue().multiGet(pages).stream().map(obj -> {
|
|
@@ -222,6 +220,7 @@ public class PigxTokenEndpoint {
|
|
|
String issuedAt = TemporalAccessorUtil.format(accessToken.getToken().getIssuedAt(),
|
|
|
DatePattern.NORM_DATETIME_PATTERN);
|
|
|
tokenVo.setIssuedAt(issuedAt);
|
|
|
+
|
|
|
Map<String, Object> attributes = authorization.getAttributes();
|
|
|
Authentication authentication = (Authentication) attributes.get(Principal.class.getName());
|
|
|
PigxUser pigxUser = (PigxUser) authentication.getPrincipal();
|
|
@@ -240,4 +239,12 @@ public class PigxTokenEndpoint {
|
|
|
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);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|