Spring Security
Project: Catalog Security
The objective of this exercise is to secure the catalog microservice of the bookstore application using basic authentication.
-
Add the starters
spring-boot-starter-security and spring-boot-starter-security-test as Maven dependencies.
-
Implement a security configuration class with bean methods that create
- a password encoder that uses the Bcrypt hashing function
- an in-memory user details service that knows users with the role
EMPLOYEE
- a security filter chain that uses basic authentication and restricts access to the REST endpoints according to requirements
-
Implement an integration test using the
MockMvc bean to verify the security constraints of the service.