- 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
推薦閱讀
- LabVIEW程序設計基礎與應用
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Learning Bayesian Models with R
- Advanced Express Web Application Development
- Learning Hadoop 2
- PHP 7從零基礎到項目實戰(zhàn)
- Microsoft HoloLens By Example
- Responsive Web Design with jQuery
- Learning D3.js 5 Mapping(Second Edition)
- LabVIEW入門與實戰(zhàn)開發(fā)100例(第4版)
- 絕密原型檔案:看看專業(yè)產(chǎn)品經(jīng)理的原型是什么樣
- HTML5 Game Development by Example:Beginner's Guide(Second Edition)
- Python機器學習
- Python程序設計現(xiàn)代方法
- 軟件工程實用教程 (第3版)