update 修改 健康检查权限 改为用户放行 提高安全性

This commit is contained in:
疯狂的狮子li 2021-12-07 12:20:21 +08:00
parent ed22f395ba
commit 09dfb25d73
2 changed files with 4 additions and 6 deletions

View File

@ -120,11 +120,11 @@ security:
- /*/api-docs
# druid 监控配置
- /druid/**
# 用户放行
permit-all:
# actuator 监控配置
- /actuator
- /actuator/**
# 用户放行
permit-all:
# 重复提交
repeat-submit:

View File

@ -2,7 +2,6 @@ package com.ruoyi.monitor.admin.config;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@ -15,7 +14,6 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true, proxyTargetClass = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final String adminContextPath;
@ -34,8 +32,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
//授予对所有静态资产和登录页面的公共访问权限
.antMatchers(adminContextPath + "/assets/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll()
.antMatchers("/actuator").anonymous()
.antMatchers("/actuator/**").anonymous()
.antMatchers("/actuator").permitAll()
.antMatchers("/actuator/**").permitAll()
//必须对每个其他请求进行身份验证
.anyRequest().authenticated().and()
//配置登录和注销