添加禁用iframe配置

This commit is contained in:
b2baccline
2020-08-10 10:02:34 +08:00
parent cac5c7ae95
commit 7e77c1ca67
3 changed files with 23 additions and 12 deletions

View File

@@ -59,6 +59,11 @@ public class CustomResourceServerConfigurer extends ResourceServerConfigurerAdap
// 关闭 csrf 跨站攻击防护
.and().csrf().disable();
// @formatter:on
// 允许嵌入iframe
if (!permitAllUrlProperties.isIframeDeny()) {
httpSecurity.headers().frameOptions().disable();
}
}
}

View File

@@ -15,12 +15,17 @@ import java.util.List;
* @date 2020/2/18 10:55 资源服务器忽略鉴权的url地址
*/
@Slf4j
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "security.oauth2")
public class PermitAllUrlProperties {
@Getter
@Setter
private List<String> ignoreUrls = new ArrayList<>();
/**
* 是否禁止嵌入iframe
*/
private boolean iframeDeny = true;
}

View File

@@ -25,7 +25,8 @@ public class DingTalkGlobalExceptionHandler extends AbstractNoticeGlobalExceptio
@Override
public ExceptionNoticeResponse send(ExceptionMessage sendMessage) {
DingTalkResponse response = sender.sendMessage(new DingTalkTextMessage().setContent(sendMessage.toString()).atAll());
DingTalkResponse response = sender
.sendMessage(new DingTalkTextMessage().setContent(sendMessage.toString()).atAll());
return new ExceptionNoticeResponse().setErrMsg(response.getResponse()).setSuccess(response.isSuccess());
}