- Spring 5.0 Microservices(Second Edition)
- Rajesh R V
- 105字
- 2021-07-02 19:45:05
Securing a microservice with basic security
Adding basic authentication to Spring Boot is pretty simple. The pom.xml file will have the following dependency. This will include the necessary Spring security library files:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
This will, by default, assume that basic security is required for this project. Run the application, and test it with a browser. The browser will ask for the login username and password.
The default basic authentication assumes the . The default password will be printed on the console at startup:
Using default security password: a7d08e07-ef5f-4623-b86c-
63054d25baed
Alternately, the username and password can be added in application.properties as shown next:
security.user.name=guest
security.user.password=guest123
推薦閱讀
- Mastering Concurrency Programming with Java 8
- 數據科學實戰手冊(R+Python)
- Python 3.7網絡爬蟲快速入門
- 工程軟件開發技術基礎
- Learning ELK Stack
- INSTANT Django 1.5 Application Development Starter
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- Unity 2017 Mobile Game Development
- UI設計全書(全彩)
- 自學Python:編程基礎、科學計算及數據分析(第2版)
- 計算機應用基礎項目化教程
- Backbone.js Testing
- Python一行流:像專家一樣寫代碼
- Arduino機器人系統設計及開發
- Microsoft Exchange Server 2016 PowerShell Cookbook(Fourth Edition)