diff --git a/urbanops-module-system/pom.xml b/urbanops-module-system/pom.xml index f5d8717..a52b79d 100644 --- a/urbanops-module-system/pom.xml +++ b/urbanops-module-system/pom.xml @@ -123,7 +123,21 @@ pinyin4j 2.5.1 - + + com.auth0 + java-jwt + 3.8.1 + + + io.jsonwebtoken + jjwt + 0.9.1 + + + com.smart.uaa + sdk + 1.0.1 + diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/enums/social/SocialTypeEnum.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/enums/social/SocialTypeEnum.java index 041f8ef..1322f30 100644 --- a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/enums/social/SocialTypeEnum.java +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/enums/social/SocialTypeEnum.java @@ -53,7 +53,11 @@ public enum SocialTypeEnum implements ArrayValuable { * @see 接入文档 */ WECHAT_MINI_PROGRAM(34, "WECHAT_MINI_PROGRAM"), - ; + + /** + * UAA + */ + UAA(35, "UAA"); public static final Integer[] ARRAYS = Arrays.stream(values()).map(SocialTypeEnum::getType).toArray(Integer[]::new); diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthRequestFactory.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthRequestFactory.java index a08969d..693a092 100644 --- a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthRequestFactory.java +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthRequestFactory.java @@ -100,9 +100,9 @@ public class AuthRequestFactory { AuthRequest authRequest = getDefaultRequest(source); // 如果获取不到则尝试取自定义的 - if (authRequest == null) { - authRequest = getExtendRequest(properties.getExtend().getEnumClass(), source); - } +// if (authRequest == null) { +// authRequest = getExtendRequest(properties.getExtend().getEnumClass(), source); +// } if (authRequest == null) { throw new AuthException(AuthResponseStatus.UNSUPPORTED); @@ -159,134 +159,136 @@ public class AuthRequestFactory { * @return {@link AuthRequest} */ private AuthRequest getDefaultRequest(String source) { - AuthDefaultSource authDefaultSource; + AuthSource authDefaultSource; try { authDefaultSource = EnumUtil.fromString(AuthDefaultSource.class, source.toUpperCase()); } catch (IllegalArgumentException e) { // 无自定义匹配 - return null; + authDefaultSource = EnumUtil.fromString(CustomerAuthSource.class, source.toUpperCase()); } - AuthConfig config = properties.getType().get(authDefaultSource.name()); + AuthConfig config = properties.getType().get(authDefaultSource.getName()); // 找不到对应关系,直接返回空 if (config == null) { return null; } // 配置 http config - configureHttpConfig(authDefaultSource.name(), config, properties.getHttpConfig()); + configureHttpConfig(authDefaultSource.getName(), config, properties.getHttpConfig()); - switch (authDefaultSource) { - case GITHUB: + switch (authDefaultSource.getName()) { + case "GITHUB": return new AuthGithubRequest(config, authStateCache); - case WEIBO: + case "WEIBO": return new AuthWeiboRequest(config, authStateCache); - case GITEE: + case "GITEE": return new AuthGiteeRequest(config, authStateCache); - case DINGTALK: + case "DINGTALK": return new AuthDingTalkRequest(config, authStateCache); - case DINGTALK_V2: + case "DINGTALK_V2": return new AuthDingTalkV2Request(config, authStateCache); - case DINGTALK_ACCOUNT: + case "DINGTALK_ACCOUNT": return new AuthDingTalkAccountRequest(config, authStateCache); - case BAIDU: + case "BAIDU": return new AuthBaiduRequest(config, authStateCache); - case CSDN: + case "CSDN": return new AuthCsdnRequest(config, authStateCache); - case CODING: + case "CODING": return new AuthCodingRequest(config, authStateCache); - case OSCHINA: + case "OSCHINA": return new AuthOschinaRequest(config, authStateCache); - case ALIPAY: + case "ALIPAY": return new AuthAlipayRequest(config, authStateCache); - case QQ: + case "QQ": return new AuthQqRequest(config, authStateCache); - case WECHAT_OPEN: + case "WECHAT_OPEN": return new AuthWeChatOpenRequest(config, authStateCache); - case WECHAT_MP: + case "WECHAT_MP": return new AuthWeChatMpRequest(config, authStateCache); - case TAOBAO: + case "TAOBAO": return new AuthTaobaoRequest(config, authStateCache); - case GOOGLE: + case "GOOGLE": return new AuthGoogleRequest(config, authStateCache); - case FACEBOOK: + case "FACEBOOK": return new AuthFacebookRequest(config, authStateCache); - case DOUYIN: + case "DOUYIN": return new AuthDouyinRequest(config, authStateCache); - case LINKEDIN: + case "LINKEDIN": return new AuthLinkedinRequest(config, authStateCache); - case MICROSOFT: + case "MICROSOFT": return new AuthMicrosoftRequest(config, authStateCache); - case MICROSOFT_CN: + case "MICROSOFT_CN": return new AuthMicrosoftCnRequest(config, authStateCache); - case MI: + case "MI": return new AuthMiRequest(config, authStateCache); - case TOUTIAO: + case "TOUTIAO": return new AuthToutiaoRequest(config, authStateCache); - case TEAMBITION: + case "TEAMBITION": return new AuthTeambitionRequest(config, authStateCache); - case RENREN: + case "RENREN": return new AuthRenrenRequest(config, authStateCache); - case PINTEREST: + case "PINTEREST": return new AuthPinterestRequest(config, authStateCache); - case STACK_OVERFLOW: + case "STACK_OVERFLOW": return new AuthStackOverflowRequest(config, authStateCache); - case HUAWEI: + case "HUAWEI": return new AuthHuaweiRequest(config, authStateCache); - case HUAWEI_V3: + case "HUAWEI_V3": return new AuthHuaweiV3Request(config, authStateCache); - case WECHAT_ENTERPRISE: + case "WECHAT_ENTERPRISE": return new AuthWeChatEnterpriseQrcodeRequest(config, authStateCache); - case WECHAT_ENTERPRISE_V2: + case "WECHAT_ENTERPRISE_V2": return new AuthWeChatEnterpriseQrcodeV2Request(config, authStateCache); - case WECHAT_ENTERPRISE_QRCODE_THIRD: + case "WECHAT_ENTERPRISE_QRCODE_THIRD": return new AuthWeChatEnterpriseThirdQrcodeRequest(config, authStateCache); - case WECHAT_ENTERPRISE_WEB: + case "WECHAT_ENTERPRISE_WEB": return new AuthWeChatEnterpriseWebRequest(config, authStateCache); - case KUJIALE: + case "KUJIALE": return new AuthKujialeRequest(config, authStateCache); - case GITLAB: + case "GITLAB": return new AuthGitlabRequest(config, authStateCache); - case MEITUAN: + case "MEITUAN": return new AuthMeituanRequest(config, authStateCache); - case ELEME: + case "ELEME": return new AuthElemeRequest(config, authStateCache); - case TWITTER: + case "TWITTER": return new AuthTwitterRequest(config, authStateCache); - case FEISHU: + case "FEISHU": return new AuthFeishuRequest(config, authStateCache); - case JD: + case "JD": return new AuthJdRequest(config, authStateCache); - case ALIYUN: + case "ALIYUN": return new AuthAliyunRequest(config, authStateCache); - case XMLY: + case "XMLY": return new AuthXmlyRequest(config, authStateCache); - case AMAZON: + case "AMAZON": return new AuthAmazonRequest(config, authStateCache); - case SLACK: + case "SLACK": return new AuthSlackRequest(config, authStateCache); - case LINE: + case "LINE": return new AuthLineRequest(config, authStateCache); - case OKTA: + case "OKTA": return new AuthOktaRequest(config, authStateCache); - case PROGINN: + case "PROGINN": return new AuthProginnRequest(config,authStateCache); - case AFDIAN: + case "AFDIAN": return new AuthAfDianRequest(config,authStateCache); - case APPLE: + case "APPLE": return new AuthAppleRequest(config,authStateCache); - case FIGMA: + case "FIGMA": return new AuthFigmaRequest(config,authStateCache); - case WECHAT_MINI_PROGRAM: + case "WECHAT_MINI_PROGRAM": config.setIgnoreCheckRedirectUri(true); config.setIgnoreCheckState(true); return new AuthWechatMiniProgramRequest(config, authStateCache); - case QQ_MINI_PROGRAM: + case "QQ_MINI_PROGRAM": config.setIgnoreCheckRedirectUri(true); config.setIgnoreCheckState(true); return new AuthQQMiniProgramRequest(config, authStateCache); + case "UAA": + return new AuthUaaRequest(config, authStateCache); default: return null; } diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthUaaRequest.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthUaaRequest.java new file mode 100644 index 0000000..b6a35af --- /dev/null +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/AuthUaaRequest.java @@ -0,0 +1,104 @@ +package com.zteits.urbanops.module.system.framework.justauth.core; + +import com.alibaba.fastjson.JSONObject; +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.interfaces.DecodedJWT; +import me.zhyd.oauth.cache.AuthStateCache; +import me.zhyd.oauth.config.AuthConfig; +import me.zhyd.oauth.enums.AuthUserGender; +import me.zhyd.oauth.exception.AuthException; +import me.zhyd.oauth.model.AuthCallback; +import me.zhyd.oauth.model.AuthToken; +import me.zhyd.oauth.model.AuthUser; +import me.zhyd.oauth.request.AuthDefaultRequest; +import org.springframework.core.io.ClassPathResource; + +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.security.interfaces.RSAPublicKey; + +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zteits.urbanops.module.system.enums.ErrorCodeConstants.AUTH_LOGIN_USER_DISABLED; + + +/** + * HRHB SSO 单点登录实现 + * + * @author gelinghu + */ +public class AuthUaaRequest extends AuthDefaultRequest { + + public AuthUaaRequest(AuthConfig config, AuthStateCache authStateCache) { + super(config, CustomerAuthSource.UAA, authStateCache); + } + + @Override + public AuthToken getAccessToken(AuthCallback authCallback) { + try { + // doPostAuthorizationCode 会使用 source 中配置的 accessToken URL + String response = this.doPostAuthorizationCode(authCallback.getCode()); + JSONObject accessTokenObject = JSONObject.parseObject(response); + this.checkResponse(accessTokenObject); + + return AuthToken.builder() + .accessToken(accessTokenObject.getString("access_token")) + .refreshToken(accessTokenObject.getString("refresh_token")) + .scope(accessTokenObject.getString("scope")) + .tokenType(accessTokenObject.getString("token_type")) + .expireIn(accessTokenObject.getIntValue("expires_in")) + .build(); + } catch (Exception e) { + // 记录详细的错误信息,便于排查问题 + throw new AuthException("获取访问令牌失败: " + e.getMessage(), e); + } + } + + @Override + public AuthUser getUserInfo(AuthToken authToken) { + CertificateFactory certificateFactory = null; + try { + certificateFactory = CertificateFactory.getInstance("X.509"); + // 读取cer公钥证书来配置解码器 + ClassPathResource resource = new ClassPathResource("pub.cer"); + Certificate certificate = certificateFactory.generateCertificate(resource.getInputStream()); + RSAPublicKey publicKey = (RSAPublicKey) certificate.getPublicKey(); + + Algorithm algorithm = Algorithm.RSA256(publicKey, null); + + JWTVerifier verifier = JWT.require(algorithm).acceptLeeway(60) + .build(); + // 解析 JWT + DecodedJWT decodedJWT = verifier.verify(authToken.getAccessToken()); + DecodedJWT jwt = JWT.decode(authToken.getAccessToken()); + String staffNo = jwt.getClaim("account").asString(); + return AuthUser.builder() + .rawUserInfo(null) + .uuid(staffNo) + .username(staffNo) + .avatar("") + .blog("") + .nickname(staffNo) + .company("") + .location("") + .email("") + .remark("") + .gender(AuthUserGender.UNKNOWN) + .token(authToken) + .source(this.source.toString()) + .build(); + } catch (Exception e) { + throw exception(AUTH_LOGIN_USER_DISABLED, "UAA登录失败"); + } + } + + /** + * 检查响应是否有错误 + */ + private void checkResponse(JSONObject object) { + if (object.containsKey("error")) { + throw new AuthException(object.getString("error_description")); + } + } +} \ No newline at end of file diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/CustomerAuthSource.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/CustomerAuthSource.java new file mode 100644 index 0000000..fef31c4 --- /dev/null +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/framework/justauth/core/CustomerAuthSource.java @@ -0,0 +1,40 @@ +package com.zteits.urbanops.module.system.framework.justauth.core; + +import me.zhyd.oauth.config.AuthSource; + +public enum CustomerAuthSource implements AuthSource { + + UAA { + @Override + public String authorize() { + return "https://test.jichengshanshui.com.cn:28301/oauth2/authorize"; +// return "http://localhost:8080/oauth2/authorize"; +// return "https://uaa.jichengshanshui.com.cn:28201/oauth2/authorize"; + } + + @Override + public String accessToken() { + return "https://test.jichengshanshui.com.cn:28301/oauth2/token"; +// return "http://localhost:8080/oauth2/token"; +// return "https://uaa.jichengshanshui.com.cn:28201/oauth2/token"; + } + + @Override + public String userInfo() { + return "https://test.jichengshanshui.com.cn:28301/oauth2/userinfo"; +// return "http://localhost:8080/oauth2/userinfo"; +// return "https://uaa.jichengshanshui.com.cn:28201/oauth2/userinfo"; + } + + @Override + public String getName() { + return "UAA"; + } + + + @Override + public Class getTargetClass() { + return CustomerAuthSource.class; + } + } +} diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/auth/AdminAuthServiceImpl.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/auth/AdminAuthServiceImpl.java index fc4ecd8..adb54aa 100644 --- a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/auth/AdminAuthServiceImpl.java +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/auth/AdminAuthServiceImpl.java @@ -175,16 +175,27 @@ public class AdminAuthServiceImpl implements AdminAuthService { // 使用 code 授权码,进行登录。然后,获得到绑定的用户编号 SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), reqVO.getType(), reqVO.getCode(), reqVO.getState()); - if (socialUser == null || socialUser.getUserId() == null) { + if (socialUser == null) { throw exception(AUTH_THIRD_LOGIN_NOT_BIND); } // 获得用户 - AdminUserDO user = userService.getUser(socialUser.getUserId()); + AdminUserDO user = null; + user = userService.getUserByUsername(socialUser.getOpenid()); + if (user == null) { + user = userService.getUserByMobile(socialUser.getOpenid()); + } + if (user == null) { throw exception(USER_NOT_EXISTS); } + if (socialUser.getUserId() == null) { + SocialUserBindReqDTO reqDTO = new SocialUserBindReqDTO(user.getId(), UserTypeEnum.ADMIN.getValue(), + reqVO.getType(), reqVO.getCode(), reqVO.getState()); + socialUserService.bindSocialUser(reqDTO); + } + // 创建 Token 令牌,记录登录日志 return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL); } diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/oauth2/SsoProperies.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/oauth2/SsoProperies.java new file mode 100644 index 0000000..4179773 --- /dev/null +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/oauth2/SsoProperies.java @@ -0,0 +1,41 @@ +package com.zteits.urbanops.module.system.service.oauth2; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * Description:

+ *

+ * Author: gelinghu + * Date: 2025年05月14 15:28 + * @author gelinghu + */ + +@Data +@Configuration +@ConfigurationProperties(prefix = "sso.client") +public class SsoProperies { + + private String switchState; + + private String clientId; + + private String clientSecret; + + private String authorizeUrl; + + private String baseUrl; + + private String redirectUri; + + private String authorizationUri; + + private String tokenUri; + + private String jwtPublicKey; + + private String syncUserUri; +} + + diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/oauth2/SsoService.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/oauth2/SsoService.java new file mode 100644 index 0000000..4fe0104 --- /dev/null +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/oauth2/SsoService.java @@ -0,0 +1,50 @@ +package com.zteits.urbanops.module.system.service.oauth2; + +import com.smart.sdk.sso.client.Oauth2Client; +import com.smart.sdk.sso.client.SsoOauth2Client; +import com.smart.sdk.sso.domain.SsoUserSyncVo; +import com.zteits.urbanops.framework.common.enums.CommonStatusEnum; +import com.zteits.urbanops.module.system.dal.dataobject.user.AdminUserDO; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * Description:

+ *

+ * Author: gelinghu + * Date: 2025年5月17 17:33 + */ +@Component +@EnableConfigurationProperties(SsoProperies.class) +public class SsoService { + + private SsoProperies ssoProperies; + + private Oauth2Client client; + + public SsoService(SsoProperies ssoProperies) { + this.ssoProperies = ssoProperies; + client = new SsoOauth2Client(ssoProperies.getClientId(), ssoProperies.getClientSecret(), ssoProperies.getBaseUrl(), ssoProperies.getRedirectUri()); + } + + public Oauth2Client getClient() { + return client; + } + + public SsoProperies getSsoProperies() { + return ssoProperies; + } + + public void syncUser(AdminUserDO user) { + SsoUserSyncVo ssoUserSyncVo = new SsoUserSyncVo(); + ssoUserSyncVo.setStaffNo(user.getMobile()) + .setAccount(user.getUsername()) + .setName(user.getNickname()) + .setEmail(user.getEmail()) + .setState(CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus()) ? 1 : 0); + getClient().syncUser(ssoUserSyncVo); + } + +} + + diff --git a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/user/AdminUserServiceImpl.java b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/user/AdminUserServiceImpl.java index a8395a8..399b2a0 100644 --- a/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/user/AdminUserServiceImpl.java +++ b/urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/user/AdminUserServiceImpl.java @@ -27,6 +27,7 @@ import com.zteits.urbanops.module.system.dal.mysql.user.AdminUserMapper; import com.zteits.urbanops.module.system.service.dept.DeptService; import com.zteits.urbanops.module.system.service.dept.PostService; import com.zteits.urbanops.module.system.service.dict.DictDataService; +import com.zteits.urbanops.module.system.service.oauth2.SsoService; import com.zteits.urbanops.module.system.service.permission.PermissionService; import com.zteits.urbanops.module.system.service.tenant.TenantService; import com.google.common.annotations.VisibleForTesting; @@ -87,6 +88,10 @@ public class AdminUserServiceImpl implements AdminUserService { @Resource private DictDataService dictDataService; + @Resource + private SsoService ssoService; + + @Override @Transactional(rollbackFor = Exception.class) @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}", @@ -115,6 +120,8 @@ public class AdminUserServiceImpl implements AdminUserService { // 3. 记录操作日志上下文 LogRecordContext.putVariable("user", user); + + ssoService.syncUser(user); return user.getId(); } @@ -232,6 +239,8 @@ public class AdminUserServiceImpl implements AdminUserService { updateObj.setId(id); updateObj.setStatus(status); userMapper.updateById(updateObj); + + ssoService.syncUser(updateObj); } @Override @@ -251,6 +260,8 @@ public class AdminUserServiceImpl implements AdminUserService { // 3. 记录操作日志上下文 LogRecordContext.putVariable("user", user); + + ssoService.syncUser(user); } @Override diff --git a/urbanops-server/src/main/resources/application-dev.yaml b/urbanops-server/src/main/resources/application-dev.yaml index 0b4e707..4bcaf6b 100644 --- a/urbanops-server/src/main/resources/application-dev.yaml +++ b/urbanops-server/src/main/resources/application-dev.yaml @@ -191,30 +191,27 @@ urbanops: justauth: enabled: true type: - DINGTALK: # 钉钉 - client-id: dingvrnreaje3yqvzhxg - client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI - ignore-check-redirect-uri: true - WECHAT_ENTERPRISE: # 企业微信 - client-id: wwd411c69a39ad2e54 - client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw - agent-id: 1000004 - ignore-check-redirect-uri: true - # noinspection SpringBootApplicationYaml - WECHAT_MINI_PROGRAM: # 微信小程序 - client-id: ${wx.miniapp.appid} - client-secret: ${wx.miniapp.secret} - ignore-check-redirect-uri: true - ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验 - WECHAT_MP: # 微信公众号 - client-id: ${wx.mp.app-id} - client-secret: ${wx.mp.secret} + UAA: + client-id: schoms + client-secret: secret + redirect-uri: https://test.jichengshanshui.com.cn:28302/test/social-login?type=35 ignore-check-redirect-uri: true cache: type: REDIS prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 +sso: + client: + switchState: on + clientId: schoms + clientSecret: secret + # 前端授权地址(改为justauth,不再这儿配置) + authorizeUrl: + # sso 服务地址 + baseUrl: https://test.jichengshanshui.com.cn:28301 + # 登录成功后跳转地址 (改为justauth,不再这儿配置) + redirectUri: --- #################### iot相关配置 TODO 芋艿【IOT】:再瞅瞅 #################### pf4j: # pluginsDir: /tmp/ @@ -235,17 +232,7 @@ flow: - appid: wy secret: x3z7t6l2g2t2i4w3x5e2e0s5y9e6d1y3 url: https://pms.jichengshanshui.com.cn:9980/prod-api/task/third/report -sso: - client: - switchState: on - clientId: schoms - clientSecret: FVwUBd3ZCrt6mMrZ - # 前端授权地址 - authorizeUrl: https://giomp.jichengshanshui.com.cn:28205/authorize - # sso 服务地址 - baseUrl: https://uaa.jichengshanshui.com.cn:28201 - # 登录成功后跳转地址 - redirectUri: https://giomp.jichengshanshui.com.cn:28205/prod-api/admin-api/sso/callback + # 微信公众号配置 wechat: mp: diff --git a/urbanops-server/src/main/resources/application-prod.yaml b/urbanops-server/src/main/resources/application-prod.yaml index b1da883..5cd9670 100644 --- a/urbanops-server/src/main/resources/application-prod.yaml +++ b/urbanops-server/src/main/resources/application-prod.yaml @@ -228,30 +228,32 @@ global: justauth: enabled: true type: - DINGTALK: # 钉钉 - client-id: dingvrnreaje3yqvzhxg - client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI - ignore-check-redirect-uri: true - WECHAT_ENTERPRISE: # 企业微信 - client-id: wwd411c69a39ad2e54 - client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw - agent-id: 1000004 - ignore-check-redirect-uri: true - # noinspection SpringBootApplicationYaml - WECHAT_MINI_PROGRAM: # 微信小程序 - client-id: ${wx.miniapp.appid} - client-secret: ${wx.miniapp.secret} - ignore-check-redirect-uri: true - ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验 - WECHAT_MP: # 微信公众号 - client-id: ${wx.mp.app-id} - client-secret: ${wx.mp.secret} + UAA: + client-id: schoms + client-secret: FVwUBd3ZCrt6mMrZ + redirect-uri: https://giomp.jichengshanshui.com.cn:4080/social-login?type=35 ignore-check-redirect-uri: true cache: type: REDIS prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 +sso: + client: + switchState: on + clientId: schoms + clientSecret: FVwUBd3ZCrt6mMrZ + # 前端授权地址(改为justauth,不再这儿配置) + authorizeUrl: + # sso 服务地址 + baseUrl: https://uaa.jichengshanshui.com.cn:28201 + # 登录成功后跳转地址 (改为justauth,不再这儿配置) + redirectUri: + cache: + type: REDIS + prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: + timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 + --- #################### iot相关配置 TODO 芋艿【IOT】:再瞅瞅 #################### pf4j: # pluginsDir: /tmp/ @@ -272,17 +274,7 @@ flow: - appid: wy secret: x3z7t6l2g2t2i4w3x5e2e0s5y9e6d1y3 url: https://pms.jichengshanshui.com.cn:9980/prod-api/task/third/report -sso: - client: - switchState: on - clientId: schoms - clientSecret: FVwUBd3ZCrt6mMrZ - # 前端授权地址 - authorizeUrl: https://giomp.jichengshanshui.com.cn:28205/authorize - # sso 服务地址 - baseUrl: https://uaa.jichengshanshui.com.cn:28201 - # 登录成功后跳转地址 - redirectUri: https://giomp.jichengshanshui.com.cn:28205/prod-api/admin-api/sso/callback + # 微信公众号配置 wechat: mp: diff --git a/urbanops-server/src/main/resources/application.yaml b/urbanops-server/src/main/resources/application.yaml index 2cfeef0..d67b2e4 100644 --- a/urbanops-server/src/main/resources/application.yaml +++ b/urbanops-server/src/main/resources/application.yaml @@ -3,7 +3,7 @@ spring: name: urbanops-server profiles: - active: prod + active: dev main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 diff --git a/urbanops-server/src/main/resources/pub.cer b/urbanops-server/src/main/resources/pub.cer new file mode 100644 index 0000000..5045fa8 --- /dev/null +++ b/urbanops-server/src/main/resources/pub.cer