根据tokne获取用户信息
This commit is contained in:
@@ -9,16 +9,16 @@ spring:
|
||||
datasource:
|
||||
master:
|
||||
# MYSQL数据库 主库,业务库
|
||||
url: jdbc:mysql://127.0.0.1:3306/gr_repoort?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: gryy@8888
|
||||
lideeyunji: # 从库,框架库
|
||||
url: jdbc:mysql://127.0.0.1:3306/gr_repoort?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: gryy@8888
|
||||
slave: # 日志库单独
|
||||
lazy: true # 开启懒加载,保证启动速度
|
||||
url: jdbc:mysql://127.0.0.1:3306/gr_repoort?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://127.0.0.1:3306/gr_report?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: gryy@8888
|
||||
oracle_gryybi: # 报表平台 oracle
|
||||
|
||||
@@ -78,5 +78,10 @@
|
||||
<artifactId>lidee-service-infra-api</artifactId>
|
||||
<version>${lidee.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.nls</groupId>
|
||||
<artifactId>orai18n</artifactId>
|
||||
<version>21.1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -97,6 +97,11 @@
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.lideeyunji</groupId>
|
||||
<artifactId>lidee-module-api</artifactId>
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.lideeyunji.service.system.config.convert.auth.AuthConvert;
|
||||
import com.lideeyunji.service.system.constant.ErrorCodeConstants;
|
||||
import com.lideeyunji.service.system.controller.vo.auth.*;
|
||||
import com.lideeyunji.service.system.controller.vo.auth.*;
|
||||
import com.lideeyunji.service.system.controller.vo.user.user.UserRespVO;
|
||||
import com.lideeyunji.service.system.entity.AdminUserDO;
|
||||
import com.lideeyunji.service.system.entity.MenuDO;
|
||||
@@ -23,7 +22,6 @@ import com.lideeyunji.tool.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.lideeyunji.tool.framework.security.config.SecurityProperties;
|
||||
import com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.lideeyunji.tool.framework.tenant.core.context.TenantContextHolder;
|
||||
import com.lideeyunji.service.system.service.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
@@ -165,8 +163,7 @@ public class AuthController {
|
||||
@Operation(tags = "根据token获取用户信息",summary = "根据token获取用户信息")
|
||||
@Parameter(name = "refreshToken", description = "根据token获取用户信息", required = true)
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<AuthLoginRespVO> getUerInfo(@RequestParam("refreshToken") String refreshToken) {
|
||||
//跟
|
||||
public CommonResult<AdminUserDO> getUerInfo(@RequestParam("refreshToken") String refreshToken) {
|
||||
return success(authService.getTokenTouserInfo(refreshToken));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,6 @@ public interface IAdminAuthService {
|
||||
*/
|
||||
AuthLoginRespVO refreshToken(String refreshToken);
|
||||
|
||||
AuthLoginRespVO getTokenTouserInfo(String refreshToken);
|
||||
AdminUserDO getTokenTouserInfo(String refreshToken);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lideeyunji.service.system.service;
|
||||
|
||||
import com.lideeyunji.service.system.entity.AdminUserDO;
|
||||
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
||||
import com.lideeyunji.service.system.controller.vo.oauth2.token.OAuth2AccessTokenPageReqVO;
|
||||
import com.lideeyunji.service.system.entity.OAuth2AccessTokenDO;
|
||||
@@ -41,6 +42,9 @@ public interface IOAuth2TokenService {
|
||||
*/
|
||||
OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId);
|
||||
|
||||
AdminUserDO getTokenTouserInfo(String refreshToken);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获得访问令牌
|
||||
|
||||
@@ -364,9 +364,9 @@ public class AdminAuthServiceImpl implements IAdminAuthService {
|
||||
|
||||
|
||||
@Override
|
||||
public AuthLoginRespVO getTokenTouserInfo(String refreshToken) {
|
||||
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);
|
||||
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
||||
public AdminUserDO getTokenTouserInfo(String refreshToken) {
|
||||
AdminUserDO user= oauth2TokenService.getTokenTouserInfo(refreshToken);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class OAuth2TokenServiceImpl implements IOAuth2TokenService {
|
||||
@Lazy // 懒加载,避免循环依赖
|
||||
private IAdminUserService adminUserService;
|
||||
|
||||
|
||||
@Override
|
||||
public OAuth2AccessTokenDO createAccessToken(Long userId, Long lastLoginDeptId, Long lastLoginRoleId, Integer userType, String clientId, List<String> scopes) {
|
||||
return createAccessToken(userId, lastLoginDeptId, lastLoginRoleId, userType, clientId, scopes,false);
|
||||
@@ -77,6 +78,16 @@ public class OAuth2TokenServiceImpl implements IOAuth2TokenService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AdminUserDO getTokenTouserInfo(String refreshToken ) {
|
||||
// 获得用户基本信息
|
||||
OAuth2AccessTokenDO accessTokenDO= oauth2AccessTokenMapper.selectByAccessToken(refreshToken);
|
||||
AdminUserDO user = adminUserService.getUser(accessTokenDO.getUserId());
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OAuth2AccessTokenDO refreshAccessToken(String refreshToken, String clientId) {
|
||||
boolean supAdmin = SecurityFrameworkUtils.isSupAdmin();
|
||||
@@ -110,6 +121,12 @@ public class OAuth2TokenServiceImpl implements IOAuth2TokenService {
|
||||
return createOAuth2AccessToken(refreshTokenDO, clientDO, supAdmin);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public OAuth2AccessTokenDO getAccessToken(String accessToken) {
|
||||
// 优先从 Redis 中获取
|
||||
|
||||
Reference in New Issue
Block a user