【Spring Cloud Config 系列】- 安全 / Security

安全 / Security

您可以以任何對您有意義的方式保護配置服務器(從物理網絡安全到 OAuth2 bearer token),
因爲 Spring security 和 Spring Boot 提供了對許多安全安排的支持。

要使用 spring boot 基於 HTTP Basic security 默認的安全配置,
可以添加依賴 implementation 'org.springframework.boot:spring-boot-starter-security',默認的用戶名是 「user」,密碼是「控制檯的隨機密碼」

控制檯會輸出如下類似的隨機密碼

Using generated security password: 77ac7b2b-b164-4def-93aa-5d6c021b0c9b

訪問配置服務器 http://localhost:11000/ 則會出現登錄頁面

在這裏插入圖片描述

在實踐中,隨機密碼並不有用,因此我們建議您配置密碼(通過設置 spring.security.user.password)並對其加密(有關如何進行加密的說明,請參閱下面的說明)。

【Spring Cloud Config 系列】- 概述-文章導航

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章