mirror of https://gitee.com/topiam/eiam
⚡ 身份源配置验证优化
parent
22d689f6d9
commit
fe066096c8
|
@ -20,6 +20,11 @@ package cn.topiam.employee.console.service.identitysource.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
@ -245,20 +250,28 @@ public class IdentitySourceServiceImpl implements IdentitySourceService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean identitySourceConfigValidator(IdentitySourceConfigValidatorParam param) {
|
public Boolean identitySourceConfigValidator(IdentitySourceConfigValidatorParam param) {
|
||||||
return switch (param.getProvider()) {
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
//钉钉
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
case DINGTALK -> {
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
DingTalkConfig config = JSONObject.parseObject(param.getConfig().toJSONString(),
|
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
||||||
DingTalkConfig.class);
|
try {
|
||||||
yield new DingTalkConfigValidator().validate(config);
|
return switch (param.getProvider()) {
|
||||||
}
|
//钉钉
|
||||||
case FEISHU -> {
|
case DINGTALK -> {
|
||||||
FeiShuConfig config = JSONObject.parseObject(param.getConfig().toJSONString(),
|
DingTalkConfig config = objectMapper
|
||||||
FeiShuConfig.class);
|
.readValue(param.getConfig().toJSONString(), DingTalkConfig.class);;
|
||||||
yield new FeiShuConfigValidator().validate(config);
|
yield new DingTalkConfigValidator().validate(config);
|
||||||
}
|
}
|
||||||
default -> throw new TopIamException("暂未支持此提供商连接验证");
|
case FEISHU -> {
|
||||||
};
|
FeiShuConfig config = objectMapper
|
||||||
|
.readValue(param.getConfig().toJSONString(), FeiShuConfig.class);
|
||||||
|
yield new FeiShuConfigValidator().validate(config);
|
||||||
|
}
|
||||||
|
default -> throw new TopIamException("暂未支持此提供商连接验证");
|
||||||
|
};
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,4 +67,7 @@ public class DingTalkConfig extends IdentitySourceConfig {
|
||||||
*/
|
*/
|
||||||
@JsonPropertyEncrypt
|
@JsonPropertyEncrypt
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
|
public DingTalkConfig() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,4 +63,7 @@ public class FeiShuConfig extends IdentitySourceConfig {
|
||||||
*/
|
*/
|
||||||
@JsonPropertyEncrypt
|
@JsonPropertyEncrypt
|
||||||
private String verificationToken;
|
private String verificationToken;
|
||||||
|
|
||||||
|
public FeiShuConfig() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue