修改获取配置方式
This commit is contained in:
parent
d6eaa1633e
commit
c6e7750750
9
pom.xml
9
pom.xml
|
@ -39,11 +39,12 @@
|
|||
<com.aliyun.oss.version>3.9.1</com.aliyun.oss.version>
|
||||
<commons.lang.version>2.6</commons.lang.version>
|
||||
<lombok.version>1.18.10</lombok.version>
|
||||
<zhyd.oauth.version>1.15.6</zhyd.oauth.version>
|
||||
<zhyd.oauth.version>1.16.5</zhyd.oauth.version>
|
||||
<jsqlparser.version>3.1</jsqlparser.version>
|
||||
<kotlin.stdlib.verson>1.3.70</kotlin.stdlib.verson>
|
||||
<zxing.version>3.4.0</zxing.version>
|
||||
<mybatis-plus.version>3.4.2</mybatis-plus.version>
|
||||
<okhttp.version>4.9.1</okhttp.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
|
@ -355,6 +356,12 @@
|
|||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.snow.web.controller.dingtalk;
|
|||
import com.snow.common.constant.Constants;
|
||||
import com.snow.common.core.controller.BaseController;
|
||||
import com.snow.common.core.domain.AjaxResult;
|
||||
import com.snow.common.utils.CacheUtils;
|
||||
import com.snow.common.utils.ServletUtils;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.framework.shiro.auth.LoginType;
|
||||
|
@ -11,7 +12,6 @@ import com.snow.framework.util.ShiroUtils;
|
|||
import com.snow.system.domain.SysAuthUser;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import com.snow.system.mapper.SysUserMapper;
|
||||
import com.snow.system.service.ISysConfigService;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
|
@ -19,11 +19,10 @@ import me.zhyd.oauth.model.AuthUser;
|
|||
import me.zhyd.oauth.request.AuthAlipayRequest;
|
||||
import me.zhyd.oauth.request.AuthDingTalkRequest;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.request.AuthWeChatEnterpriseRequest;
|
||||
import me.zhyd.oauth.request.AuthWeChatEnterpriseQrcodeRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
@ -42,9 +41,6 @@ import java.io.IOException;
|
|||
@RequestMapping("/third/oauth")
|
||||
public class ThirdOauthController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService iSysConfigService;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
@ -148,13 +144,13 @@ public class ThirdOauthController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
private AuthRequest getDingTalkAuthRequest() {
|
||||
String appId= iSysConfigService.selectConfigByKey("ding.login.appid");
|
||||
String appSecret= iSysConfigService.selectConfigByKey("ding.login.appSecret");
|
||||
String redirectUri= iSysConfigService.selectConfigByKey("ding.login.redirectUri");
|
||||
Object appId = CacheUtils.getSysConfig("sys_config:ding.login.appid");
|
||||
Object appSecret = CacheUtils.getSysConfig("sys_config:ding.login.appSecret");
|
||||
Object redirectUri = CacheUtils.getSysConfig("sys_config:ding.login.redirectUri");
|
||||
return new AuthDingTalkRequest(AuthConfig.builder()
|
||||
.clientId(appId)
|
||||
.clientSecret(appSecret)
|
||||
.redirectUri(redirectUri)
|
||||
.clientId(String.valueOf(appId))
|
||||
.clientSecret(String.valueOf(appSecret))
|
||||
.redirectUri(String.valueOf(redirectUri))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
@ -163,26 +159,26 @@ public class ThirdOauthController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
private AuthRequest getWeChatAuthRequest() {
|
||||
String clientId= iSysConfigService.selectConfigByKey("wechart.login.clientId");
|
||||
String appSecret= iSysConfigService.selectConfigByKey("wechart.login.appSecret");
|
||||
String redirectUri= iSysConfigService.selectConfigByKey("wechart.login.redirectUri");
|
||||
String agentId= iSysConfigService.selectConfigByKey("wechart.login.agentId");
|
||||
return new AuthWeChatEnterpriseRequest(AuthConfig.builder()
|
||||
.clientId(clientId)
|
||||
.clientSecret(appSecret)
|
||||
.redirectUri(redirectUri)
|
||||
.agentId(agentId)
|
||||
Object agentId = CacheUtils.getSysConfig("sys_config:wechart.login.agentId");
|
||||
Object clientId = CacheUtils.getSysConfig("sys_config:wechart.login.clientId");
|
||||
Object appSecret = CacheUtils.getSysConfig("sys_config:wechart.login.appSecret");
|
||||
Object redirectUri = CacheUtils.getSysConfig("sys_config:wechart.login.redirectUri");
|
||||
return new AuthWeChatEnterpriseQrcodeRequest(AuthConfig.builder()
|
||||
.clientId(String.valueOf(clientId))
|
||||
.clientSecret(String.valueOf(appSecret))
|
||||
.redirectUri(String.valueOf(redirectUri))
|
||||
.agentId(String.valueOf(agentId))
|
||||
.build());
|
||||
}
|
||||
|
||||
private AuthRequest getAlipayAuthRequest() {
|
||||
String appId= iSysConfigService.selectConfigByKey("alipay.login.appId");
|
||||
String redirectUri= iSysConfigService.selectConfigByKey("alipay.login.redirectUri");
|
||||
Object appId = CacheUtils.getSysConfig("sys_config:alipay.login.appId");
|
||||
Object redirectUri = CacheUtils.getSysConfig("sys_config:alipay.login.redirectUri");
|
||||
return new AuthAlipayRequest(AuthConfig.builder()
|
||||
.clientId(appId)
|
||||
.clientId(String.valueOf(appId))
|
||||
.clientSecret(Constants.ALIPAY_RSA_PRIVATE_KEY)
|
||||
.alipayPublicKey(Constants.ALIPAY_PUBLIC_KEY)
|
||||
.redirectUri(redirectUri)
|
||||
.redirectUri(String.valueOf(redirectUri))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -137,8 +137,8 @@
|
|||
|
||||
<!-- HttpClient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue