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 高可用流量管理框架: 以流量為切入點,限流、流量整形、熔斷降級、系統負載保護、熱點防護


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM