fix: 更新身份源配置&保存存储配置

pull/34/MERGE
kay 2023-08-20 11:09:30 +00:00 committed by smallbun
parent 2b5a21e345
commit afc4b5e441
2 changed files with 9 additions and 5 deletions

View File

@ -115,7 +115,7 @@ public interface IdentitySourceRepository extends LogicDeleteRepository<Identity
void deleteById(@NonNull Long id);
/**
*
*
*
* @param id {@link Long}
* @param strategyConfig {@link String}
@ -123,7 +123,7 @@ public interface IdentitySourceRepository extends LogicDeleteRepository<Identity
@Transactional(rollbackFor = Exception.class)
@Modifying
@CacheEvict(allEntries = true)
@Query(value = "UPDATE IdentitySourceEntity SET strategyConfig=:strategyConfig where id=:id")
@Query(value = "UPDATE identity_source SET strategy_config = :strategyConfig where id_ = :id", nativeQuery = true)
void updateStrategyConfig(@Param(value = "id") Long id,
@Param(value = "strategyConfig") String strategyConfig);

View File

@ -177,9 +177,13 @@ public class SettingHelp {
public static void addImgSrcHostContentSecurityPolicy(String value) {
SettingEntity settingEntity = getSettingRepository()
.findByName(SECURITY_DEFENSE_POLICY_CONTENT_SECURITY_POLICY);
String contentSecurityPolicy = SECURITY_DEFENSE_POLICY_DEFAULT_SETTINGS
.get(SECURITY_DEFENSE_POLICY_CONTENT_SECURITY_POLICY);
if (!Objects.isNull(settingEntity)) {
String contentSecurityPolicy;
if (Objects.isNull(settingEntity)) {
settingEntity = new SettingEntity();
settingEntity.setName(SECURITY_DEFENSE_POLICY_CONTENT_SECURITY_POLICY);
contentSecurityPolicy = SECURITY_DEFENSE_POLICY_DEFAULT_SETTINGS
.get(SECURITY_DEFENSE_POLICY_CONTENT_SECURITY_POLICY);
} else {
contentSecurityPolicy = settingEntity.getValue();
}
Policy parse = ContentSecurityPolicyUtils.parse(contentSecurityPolicy);