验证部分改走内网
This commit is contained in:
parent
154c88d8bf
commit
5e56d21107
|
|
@ -20,6 +20,11 @@ public class UnifiedAuthConfig {
|
||||||
*/
|
*/
|
||||||
private String authUrl;
|
private String authUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 认证地址(内网)
|
||||||
|
*/
|
||||||
|
private String authUrlIntranet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户端ID
|
* 客户端ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -71,27 +76,27 @@ public class UnifiedAuthConfig {
|
||||||
* 获取完整令牌接口URL
|
* 获取完整令牌接口URL
|
||||||
*/
|
*/
|
||||||
public String getTokenUrl() {
|
public String getTokenUrl() {
|
||||||
return authUrl + tokenPath;
|
return authUrlIntranet + tokenPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整用户信息接口URL
|
* 获取完整用户信息接口URL
|
||||||
*/
|
*/
|
||||||
public String getUserinfoUrl() {
|
public String getUserinfoUrl() {
|
||||||
return authUrl + userinfoPath;
|
return authUrlIntranet + userinfoPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整验证令牌接口URL
|
* 获取完整验证令牌接口URL
|
||||||
*/
|
*/
|
||||||
public String getCheckTokenUrl() {
|
public String getCheckTokenUrl() {
|
||||||
return authUrl + checkTokenPath;
|
return authUrlIntranet + checkTokenPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整单点登出接口URL
|
* 获取完整单点登出接口URL
|
||||||
*/
|
*/
|
||||||
public String getLogoutUrl() {
|
public String getLogoutUrl() {
|
||||||
return authUrl + logoutPath;
|
return authUrlIntranet + logoutPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -49,14 +49,6 @@ public class ImsSyncController {
|
||||||
@ApiOperation(value = "机构同步接口", notes = "接收IMS推送的机构数据,支持新增、修改、删除操作")
|
@ApiOperation(value = "机构同步接口", notes = "接收IMS推送的机构数据,支持新增、修改、删除操作")
|
||||||
public ImsResultVO orgSynchronous(@RequestBody ImsOrgDTO dto, HttpServletRequest request) {
|
public ImsResultVO orgSynchronous(@RequestBody ImsOrgDTO dto, HttpServletRequest request) {
|
||||||
log.info("IMS机构同步请求: type={}, orgCode={}", dto.getType(), dto.getCode());
|
log.info("IMS机构同步请求: type={}, orgCode={}", dto.getType(), dto.getCode());
|
||||||
try (ServletInputStream inputStream = request.getInputStream();
|
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
|
||||||
IOUtils.copy(inputStream, os);
|
|
||||||
log.info("IMS机构同步请求body:{}", os);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("IMS机构同步请求参数读取失败", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean result = imsOrgService.syncOrg(dto);
|
boolean result = imsOrgService.syncOrg(dto);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
@ -82,14 +74,6 @@ public class ImsSyncController {
|
||||||
public ImsResultVO userSynchronous(@RequestBody ImsUserDTO dto, HttpServletRequest request) {
|
public ImsResultVO userSynchronous(@RequestBody ImsUserDTO dto, HttpServletRequest request) {
|
||||||
log.info("IMS用户同步请求: type={}, userCode={}", dto.getType(), dto.getUsercode());
|
log.info("IMS用户同步请求: type={}, userCode={}", dto.getType(), dto.getUsercode());
|
||||||
|
|
||||||
try (ServletInputStream inputStream = request.getInputStream();
|
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
|
||||||
IOUtils.copy(inputStream, os);
|
|
||||||
log.info("IMS用户同步请求body:{}", os);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("IMS用户同步请求参数读取失败", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean result = imsUserService.syncUser(dto);
|
boolean result = imsUserService.syncUser(dto);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,17 @@ import com.chinaweal.aiccs.org.entity.dto.UnifiedAuthDTO;
|
||||||
import com.chinaweal.aiccs.org.service.IUnifiedAuthService;
|
import com.chinaweal.aiccs.org.service.IUnifiedAuthService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -41,7 +46,11 @@ public class UnifiedAuthServiceImpl implements IUnifiedAuthService {
|
||||||
StringBuilder url = new StringBuilder(unifiedAuthConfig.getAuthorizeUrl());
|
StringBuilder url = new StringBuilder(unifiedAuthConfig.getAuthorizeUrl());
|
||||||
url.append("?response_type=code");
|
url.append("?response_type=code");
|
||||||
url.append("&client_id=").append(unifiedAuthConfig.getClientId());
|
url.append("&client_id=").append(unifiedAuthConfig.getClientId());
|
||||||
url.append("&redirect_uri=").append(unifiedAuthConfig.getRedirectUri());
|
try {
|
||||||
|
url.append("&redirect_uri=").append(URLEncoder.encode(unifiedAuthConfig.getRedirectUri(), "utf-8"));
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
log.error("{}的UrlEncode失败", unifiedAuthConfig.getRedirectUri(), e);
|
||||||
|
}
|
||||||
url.append("&state=").append(state);
|
url.append("&state=").append(state);
|
||||||
|
|
||||||
log.info("构建统一认证平台登录URL: {}", url.toString());
|
log.info("构建统一认证平台登录URL: {}", url.toString());
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,8 @@ oauth2:
|
||||||
unified-auth:
|
unified-auth:
|
||||||
# 认证地址,根据实际环境配置
|
# 认证地址,根据实际环境配置
|
||||||
auth-url: ${UNIFIED_AUTH_URL:https://58.18.173.243:8002}
|
auth-url: ${UNIFIED_AUTH_URL:https://58.18.173.243:8002}
|
||||||
|
# 认证地址,内网
|
||||||
|
auth-url-intranet: ${UNIFIED_AUTH_URL_INTRANET:https://10.6.48.70:443}
|
||||||
# 客户端ID,由统一认证平台分配
|
# 客户端ID,由统一认证平台分配
|
||||||
client-id: ${UNIFIED_AUTH_CLIENT_ID:xyjgxt}
|
client-id: ${UNIFIED_AUTH_CLIENT_ID:xyjgxt}
|
||||||
# 客户端秘钥,由统一认证平台分配
|
# 客户端秘钥,由统一认证平台分配
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue