官术网_书友最值得收藏!

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
主站蜘蛛池模板: 长治县| 怀柔区| 共和县| 淮安市| 徐汇区| 贺兰县| 扎鲁特旗| 江门市| 安新县| 大悟县| 赞皇县| 禹州市| 永仁县| 依安县| 耒阳市| 墨竹工卡县| 砚山县| 登封市| 韶山市| 旺苍县| 刚察县| 长汀县| 白山市| 新河县| 乌苏市| 南木林县| 织金县| 措勤县| 安西县| 晴隆县| 开封县| 兖州市| 阳谷县| 龙川县| 宁国市| 孝义市| 甘肃省| 台前县| 潢川县| 根河市| 武鸣县|