Spring Boot Security : Authentication And Authorization
In this tutorial, we will learn How to make secure rest API’s using basic authentication and authorization.
Okay, Lets create one spring boot application and after that we will implement the spring security to our rest API.
Go to : https://start.spring.io/
and Enter project details and will add two dependencies Spring Web and Spring Security.
Import Project into IDE. I have imported into intellij IDE . Okay Lets use the default security provided by spring boot application. After that we will implement customize security based on Role and URL.
Okay . So first we will see how to enable spring boot default security and will make secure rest API’s.
First we need to add @EnableWebSecurity annotation at class level.
After enabling spring security. Now we will create rest endpoint in our spring boot application.