February 2017
Intermediate to advanced
1023 pages
24h 11m
English
It is important to secure microservices. In this section, some basic measures to secure Spring Boot microservices will be reviewed using chapter2.bootrest to demonstrate the security features.
Adding basic authentication to Spring Boot is pretty simple. Add the following dependency to pom.xml. This will include the necessary Spring security library files:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Open Application.java and add @EnableGlobalMethodSecurity to the Application class. This annotation will enable method-level security:
@EnableGlobalMethodSecurity @SpringBootApplication public class ...
Read now
Unlock full access