- 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
推薦閱讀
- Power Up Your PowToon Studio Project
- PHP網(wǎng)絡編程學習筆記
- Instant QlikView 11 Application Development
- Full-Stack Vue.js 2 and Laravel 5
- Linux操作系統(tǒng)基礎案例教程
- 琢石成器:Windows環(huán)境下32位匯編語言程序設計
- Python機器學習:預測分析核心算法
- Hands-On Nuxt.js Web Development
- IDA Pro權威指南(第2版)
- OpenCV 3計算機視覺:Python語言實現(xiàn)(原書第2版)
- OpenCV Android Programming By Example
- JavaScript悟道
- Mastering Apache Camel
- Building Clouds with Windows Azure Pack
- Python程序設計:基礎與實踐