1.?pom.xml 加入依賴
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、網(wǎng)絡(luò)空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、道外網(wǎng)站維護(hù)、網(wǎng)站推廣。
<!--?加入密碼認(rèn)證?--> <dependency> ????????????<groupId>org.springframework.boot</groupId> ????????????<artifactId>spring-boot-starter-security</artifactId> ????????</dependency>
2.?application.properties 配置如下 用戶名和密碼
#開啟安全認(rèn)證?用戶名和密碼spring.security.basic.enabled=truespring.security.user.name=adminspring.security.user.password=root
3. 加入配置類?WebSecurityConfig.java
package?org.fh.config;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;import?org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;/** ?*?說(shuō)明:CSRF保護(hù)禁用 ?*?作者:www.1b23.com ?*/@EnableWebSecuritypublic?class?WebSecurityConfig?extends?WebSecurityConfigurerAdapter?{ ????@Override ????protected?void?configure(HttpSecurity?http)?throws?Exception?{ ???? ???? SavedRequestAwareAuthenticationSuccessHandler?successHandler?=?new?SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.headers().frameOptions().disable(); ???? ???? http.csrf().disable().authorizeRequests().antMatchers("/actuator/**").permitAll().anyRequest().authenticated().and().httpBasic(); ????} }
?
文章標(biāo)題:springcloud配置eureka訪問(wèn)密碼
當(dāng)前地址:http://muchs.cn/article20/pgocco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司、做網(wǎng)站、網(wǎng)站導(dǎo)航、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站內(nèi)鏈、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)