提交 40d5e6f1 编写于 作者: 武汉红喜's avatar 武汉红喜

disable csrf

上级 36b98f0f
......@@ -5,4 +5,8 @@
```
curl http://localhost:8080/actuator/mappings -u application:whatsmars-spring-boot
```
\ No newline at end of file
```
如果要禁止http访问actuator,有两种方式:
- 增加 ActuatorFilter,拦截 /actuator 开头的请求
- 非Web应用中去掉Web模块
\ No newline at end of file
......@@ -27,10 +27,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.hongxi</groupId>
<artifactId>whatsmars-common</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -23,7 +23,8 @@ public class StandardWebSecurityConfigurer extends WebSecurityConfigurerAdapter
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
http.csrf().disable()
.authorizeRequests()
.requestMatchers(EndpointRequest.to(
MappingsEndpoint.class,
EnvironmentEndpoint.class,
......@@ -36,7 +37,7 @@ public class StandardWebSecurityConfigurer extends WebSecurityConfigurerAdapter
.anyRequest()
.permitAll()
.and()
.httpBasic();
.httpBasic();
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册