spring boot-admin 监控中心 配置登录密码
1. pom 加入 security
<!-- 加入密码认证 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
2.加入配置类 SecuritySecureConfig
package org.fh.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
/**
* 说明:SecuritySecure配置
* 作者:FH Admin
* from:fhadmin.cn
*/
@Configuration
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
http.headers().frameOptions().disable();
http.authorizeRequests().antMatchers(adminContextPath + "/assets/**",adminContextPath + "/actuator/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll().anyRequest().authenticated().and().formLogin()
.loginPage(adminContextPath + "/login").successHandler(successHandler).and().logout()
.logoutUrl(adminContextPath + "/logout").and().httpBasic().and().csrf().disable();
}
}
3. 配置application.properties
#开启安全认证 用户名和密码
spring.security.user.name=fhadmin
spring.security.user.password=root
spring.security.basic.enabled=true
当前最新框架组合方案-------------------------------------------------------------------------------------
(后台框架 :springcloud 2021.0.1 + springcloud Alibaba 2021.0.1.0 + springboot 2.6.5 + flowable6.7.2 流程引擎 )
springcloud服务 (fhadmin.cn)
1 .nacos 阿里注册中心:官方eureka停止更新,目前比较好的取代者就是nacos
2. zipkin 跟踪服务:分布式跟踪日志,基于内存存储记录
3 .gateway 网关路由服务:分发请求,统一管理过滤,结合 LoadBalancer负载均衡、 feign服务调用
4. springboot-admin 监控中心服务:统一界面管理,查看各个服务运行状态 actuator健康检查
5. sentinel 高可用流量管理框架: 以流量为切入点,限流、流量整形、熔断降级、系统负载保护、热点防护
热门相关:帝少的专属:小甜心,太缠人 霸皇纪 刺客之王 薄先生,情不由己 大神你人设崩了