opensso切换生产环境
This commit is contained in:
+8
-5
@@ -16,6 +16,7 @@ import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.modules.system.util.HttpRequestUtil;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -63,6 +64,8 @@ public class SSOLoginController {
|
||||
//密码登录错误的最大限制次数
|
||||
public static final int RETRY_LOGIN_MAX_COUNT = 5;
|
||||
|
||||
@Value("${opensso.authorizeUrl}")
|
||||
private String authorizeUrl;
|
||||
@Value("${opensso.accessTokenUrl}")
|
||||
private String accessTokenUrl;
|
||||
@Value("${opensso.profileUrl}")
|
||||
@@ -79,7 +82,7 @@ public class SSOLoginController {
|
||||
@GetMapping(value = "/ssoAuth")
|
||||
public void ssoAuth(HttpServletRequest request, HttpServletResponse response){
|
||||
String callbackUri = "http%3A%2F%2F139.9.235.66%3A8008%2Fjero-boot%2Fopensso%2Fcallback";
|
||||
String authUrl = "https://signin-test.nio.com/oauth2/authorize" +"?client_id=" + clientId
|
||||
String authUrl = authorizeUrl +"?client_id=" + clientId
|
||||
+ "&redirect_uri=" + redirectUri + "&response_type=code";
|
||||
try {
|
||||
response.sendRedirect(authUrl);
|
||||
@@ -103,8 +106,8 @@ public class SSOLoginController {
|
||||
log.info("access_token_url:" + getAccessTokenUrl);
|
||||
Map<String, String> headerMapToken = new HashMap<>();
|
||||
headerMapToken.put("Content-Type", "text/html;charset=utf-8");
|
||||
// String accessTokenResult = HttpRequestUtil.getResponseOfGET(getAccessTokenUrl, headerMapToken);
|
||||
String accessTokenResult = "access_token=2.0N6OFCARTH7MRCVPSENQONSA67WGHV4FDR25TSHFCCXI6FA3NRVAA----&expires=602405";
|
||||
String accessTokenResult = HttpRequestUtil.getResponseOfGET(getAccessTokenUrl, headerMapToken);
|
||||
// String accessTokenResult = "access_token=2.0N6OFCARTH7MRCVPSENQONSA67WGHV4FDR25TSHFCCXI6FA3NRVAA----&expires=602405";
|
||||
log.info("获取access_token返回结果:" + accessTokenResult);
|
||||
// 返回结果:access_token=2.0N6OFCARTH7MRCVPSENQONSA67WGHV4FDR25TSHFCCXI6FA3NRVAA----&expires=602405
|
||||
if(StringUtils.isEmpty(accessTokenResult) || !accessTokenResult.contains("access_token")){
|
||||
@@ -120,8 +123,8 @@ public class SSOLoginController {
|
||||
log.info("profile_url:" + getProfileUrl);
|
||||
Map<String, String> headerMapProfile = new HashMap<>();
|
||||
headerMapProfile.put("Content-Type", "application/json; charset=utf-8");
|
||||
// String profileResult = HttpRequestUtil.getResponseOfGET(getProfileUrl, headerMapProfile);
|
||||
String profileResult = "{ id: \"chengjun.wang.o\", attributes: [{workNo: \"\"},{account_id: \"\"},{user_name: \"chengjun.wang.o\"},{email: \"chengjun.wang.o@nio.com\"}]}";
|
||||
String profileResult = HttpRequestUtil.getResponseOfGET(getProfileUrl, headerMapProfile);
|
||||
// String profileResult = "{ id: \"chengjun.wang.o\", attributes: [{workNo: \"\"},{account_id: \"\"},{user_name: \"chengjun.wang.o\"},{email: \"chengjun.wang.o@nio.com\"}]}";
|
||||
log.info("获取profile返回结果:" + profileResult);
|
||||
// 返回结果:{ id: "chengjun.wang.o", attributes: [{workNo: ""},{account_id: ""},{user_name: "chengjun.wang.o"},{email: "chengjun.wang.o@nio.com"}]}
|
||||
JSONObject userThirdIdJson = JSONObject.parseObject(profileResult);
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ public class PPSyncDataTimer {
|
||||
@Autowired
|
||||
private ISyncDataService syncDataService;
|
||||
|
||||
// @Scheduled(cron = "0 10 0 * * ?") //每天凌晨0点10分执行
|
||||
@Scheduled(cron = "0 10 0 * * ?") //每天凌晨0点10分执行
|
||||
public void syncDepartInfo() {
|
||||
if (isOpen) {
|
||||
log.info("<======================================启动同步部门信息======================================>");
|
||||
@@ -47,7 +47,7 @@ public class PPSyncDataTimer {
|
||||
}
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 10 1 * * ?") //每天凌晨1点10分执行
|
||||
@Scheduled(cron = "0 10 1 * * ?") //每天凌晨1点10分执行
|
||||
public void syncUserInfo() {
|
||||
log.info("<======================================启动同步用户信息=======================================>");
|
||||
if (isOpen) {
|
||||
|
||||
Reference in New Issue
Block a user