增加演示环境 ***** 敏感数据处理
This commit is contained in:
parent
d7b6dc992f
commit
4a7fd71da7
|
|
@ -54,7 +54,8 @@ public class LikeAdminInterceptor implements HandlerInterceptor {
|
|||
}
|
||||
|
||||
// 演示环境拦截
|
||||
if (YmlUtils.get("like.production").equals("true")) {
|
||||
String env = YmlUtils.get("like.production");
|
||||
if (StringUtils.isNotNull(env) && env.equals("true")) {
|
||||
List<String> ignoreUrl = Arrays.asList("system:login", "system:logout");
|
||||
if (request.getMethod().equals("POST") && !ignoreUrl.contains(auths)) {
|
||||
String message = "演示环境不支持修改数据,请下载源码本地部署体验";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public interface IChannelMpConfigService {
|
|||
* 微信小程序设置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param channelMpValidate
|
||||
* @param channelMpValidate 参数
|
||||
*/
|
||||
void save(ChannelMpValidate channelMpValidate);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ package com.mdd.admin.service.impl;
|
|||
import com.mdd.admin.service.IChannelMpConfigService;
|
||||
import com.mdd.admin.validate.channel.ChannelMpValidate;
|
||||
import com.mdd.admin.vo.channel.ChannelMpVo;
|
||||
import com.mdd.common.util.ConfigUtils;
|
||||
import com.mdd.common.util.RequestUtils;
|
||||
import com.mdd.common.util.UrlUtils;
|
||||
import com.mdd.common.util.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -26,14 +24,16 @@ public class ChannelMpConfigServiceImpl implements IChannelMpConfigService {
|
|||
public ChannelMpVo detail() {
|
||||
Map<String, String> config = ConfigUtils.get("mp_channel");
|
||||
|
||||
String env = YmlUtils.get("like.production");
|
||||
boolean envStatus = StringUtils.isNotNull(env) && env.equals("true");
|
||||
|
||||
ChannelMpVo vo = new ChannelMpVo();
|
||||
vo.setName(config.getOrDefault("name", ""));
|
||||
vo.setPrimaryId(config.getOrDefault("primaryId", ""));
|
||||
vo.setAppId(config.getOrDefault("appId", ""));
|
||||
vo.setAppSecret(config.getOrDefault("appSecret", ""));
|
||||
vo.setAppId(envStatus ? "******" : config.getOrDefault("appId", ""));
|
||||
vo.setAppSecret(envStatus ? "******" : config.getOrDefault("appSecret", ""));
|
||||
vo.setQrCode(UrlUtils.toAbsoluteUrl(config.getOrDefault("qrCode", "")));
|
||||
|
||||
|
||||
String domain = RequestUtils.domain();
|
||||
vo.setRequestDomain(domain);
|
||||
vo.setSocketDomain(domain);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ package com.mdd.admin.service.impl;
|
|||
import com.mdd.admin.service.IChannelOaConfigService;
|
||||
import com.mdd.admin.validate.channel.ChannelOaValidate;
|
||||
import com.mdd.admin.vo.channel.ChannelOaVo;
|
||||
import com.mdd.common.util.ConfigUtils;
|
||||
import com.mdd.common.util.RequestUtils;
|
||||
import com.mdd.common.util.UrlUtils;
|
||||
import com.mdd.common.util.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -27,11 +25,14 @@ public class ChannelOaConfigServiceImpl implements IChannelOaConfigService {
|
|||
Map<String, String> config = ConfigUtils.get("oa_channel");
|
||||
ChannelOaVo vo = new ChannelOaVo();
|
||||
|
||||
String env = YmlUtils.get("like.production");
|
||||
boolean envStatus = StringUtils.isNotNull(env) && env.equals("true");
|
||||
|
||||
vo.setQrCode(UrlUtils.toAbsoluteUrl(config.getOrDefault("qrCode", "")));
|
||||
vo.setName(config.getOrDefault("name", ""));
|
||||
vo.setPrimaryId(config.getOrDefault("primaryId", ""));
|
||||
vo.setAppId(config.getOrDefault("appId", ""));
|
||||
vo.setAppSecret(config.getOrDefault("appSecret", ""));
|
||||
vo.setAppId(envStatus ? "******" : config.getOrDefault("appId", ""));
|
||||
vo.setAppSecret(envStatus ? "******" : config.getOrDefault("appSecret", ""));
|
||||
vo.setUrl(config.getOrDefault("url", ""));
|
||||
vo.setToken(config.getOrDefault("token", ""));
|
||||
vo.setEncodingAesKey(config.getOrDefault("encodingAesKey", ""));
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.mdd.admin.service.IChannelOpService;
|
|||
import com.mdd.admin.validate.channel.ChannelOpValidate;
|
||||
import com.mdd.admin.vo.channel.ChannelOpVo;
|
||||
import com.mdd.common.util.ConfigUtils;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.YmlUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
|
@ -23,9 +25,12 @@ public class ChannelOpServiceImpl implements IChannelOpService {
|
|||
String appId = ConfigUtils.get("op_channel", "appId", "");
|
||||
String appSecret = ConfigUtils.get("op_channel", "appSecret", "");
|
||||
|
||||
String env = YmlUtils.get("like.production");
|
||||
boolean envStatus = StringUtils.isNotNull(env) && env.equals("true");
|
||||
|
||||
ChannelOpVo vo = new ChannelOpVo();
|
||||
vo.setAppId(appId);
|
||||
vo.setAppSecret(appSecret);
|
||||
vo.setAppId(envStatus ? "******" : appId);
|
||||
vo.setAppSecret(envStatus ? "******" : appSecret);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|||
import com.mdd.admin.service.ISettingSmsService;
|
||||
import com.mdd.common.util.ConfigUtils;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.YmlUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -48,6 +49,9 @@ public class SettingSmsServiceImpl implements ISettingSmsService {
|
|||
*/
|
||||
@Override
|
||||
public Map<String, Object> detail(String alias) {
|
||||
String env = YmlUtils.get("like.production");
|
||||
boolean envStatus = StringUtils.isNotNull(env) && env.equals("true");
|
||||
|
||||
String engine = ConfigUtils.get("sms", "default", "local");
|
||||
Map<String, String> config = ConfigUtils.getMap("sms", alias);
|
||||
config = StringUtils.isNotNull(config) ? config : Collections.emptyMap();
|
||||
|
|
@ -60,13 +64,13 @@ public class SettingSmsServiceImpl implements ISettingSmsService {
|
|||
|
||||
switch (alias) {
|
||||
case "aliyun":
|
||||
map.put("appKey", config.getOrDefault("appKey", ""));
|
||||
map.put("secretKey", config.getOrDefault("secretKey", ""));
|
||||
map.put("appKey", envStatus ? "******" : config.getOrDefault("appKey", ""));
|
||||
map.put("secretKey", envStatus ? "******" : config.getOrDefault("secretKey", ""));
|
||||
break;
|
||||
case "tencent":
|
||||
map.put("appId", config.getOrDefault("appId", ""));
|
||||
map.put("secretId", config.getOrDefault("secretId", ""));
|
||||
map.put("secretKey", config.getOrDefault("secretKey", ""));
|
||||
map.put("appId", envStatus ? "******" : config.getOrDefault("appId", ""));
|
||||
map.put("secretId", envStatus ? "******" : config.getOrDefault("secretId", ""));
|
||||
map.put("secretKey", envStatus ? "******" : config.getOrDefault("secretKey", ""));
|
||||
break;
|
||||
case "huawei":
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Assert;
|
|||
import com.mdd.admin.service.ISettingStorageService;
|
||||
import com.mdd.common.util.ConfigUtils;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.YmlUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -66,6 +67,9 @@ public class SettingStorageServiceImpl implements ISettingStorageService {
|
|||
*/
|
||||
@Override
|
||||
public Map<String, Object> detail(String alias) {
|
||||
String env = YmlUtils.get("like.production");
|
||||
boolean envStatus = StringUtils.isNotNull(env) && env.equals("true");
|
||||
|
||||
String engine = ConfigUtils.get("storage", "default", "local");
|
||||
Map<String, String> config = ConfigUtils.getMap("storage", alias);
|
||||
config = StringUtils.isNotNull(config) ? config : Collections.emptyMap();
|
||||
|
|
@ -76,8 +80,8 @@ public class SettingStorageServiceImpl implements ISettingStorageService {
|
|||
map.put("status", engine.equals(alias) ? 1 : 0);
|
||||
if (!alias.equals("local")) {
|
||||
map.put("bucket", config.getOrDefault("bucket", ""));
|
||||
map.put("secretKey", config.getOrDefault("secretKey", ""));
|
||||
map.put("accessKey", config.getOrDefault("accessKey", ""));
|
||||
map.put("secretKey", envStatus ? "******" : config.getOrDefault("secretKey", ""));
|
||||
map.put("accessKey", envStatus ? "******" : config.getOrDefault("accessKey", ""));
|
||||
map.put("domain", config.getOrDefault("domain", ""));
|
||||
if (alias.equals("qcloud")) {
|
||||
map.put("region", config.getOrDefault("region", ""));
|
||||
|
|
|
|||
Loading…
Reference in New Issue