Spring Boot With JWT: II - JWT Config
By ski11up.com
Authentication
When we are developing any software application, we want the right set of users to gain access to the application. The process of making sure that the right users gain access to the application is known as authentication.
There are various ways for implementing the authentication, the most common are mentioned below:
-
Basic Authentication
-
Session-Based Authentication
-
Token-Based Authentication
-
OAuth2-Based Authentication
Basic Authentication
When the user logs in to the application, a base64 encoded username/password is sent to the server each time a request has been made in the authorization header. This is stateless authentication since you need to make each request with the encoded username/password each time.
Session-Based Authentication
When the user logs in to the application, SessionID or commonly known as JSESSION_ID is created. This SessionID is stored in the Cookie. With each request, SessionID is sent to the server for accessing the resources. This is stateful authentication.
Token-Based Authentication
Token-Based authentication is one of the most popular ways of authentication a user. It provides a secure way of transmitting the information between the parties as a JSON object. This information can be verified and trusted based on private/public key mechanisms.
OAuth2-Based Authentication
OAuth2-Based authentication is one step ahead of Token-Based Authentication. It has an Authentication server to verify the authenticity of the user. The request is transmitted to the resource server to access the resources after successfully authenticating the user.
In this blog post series, we will implement Token-Based Authentication using Spring-Boot. It is known as JWT based authentication.
Spring Boot
Spring Boot provides a handy way to implement JWT based authentication. It is effortless to implement JWT based authentication using Spring Boot.
Authentication Process
User logs in to the application and hits the authentication API, a JWT has been created, and then it will be passed in the authentication header for accessing resources.
Next
Go to Spring Boot With JWT: III - JWT Entry Point to get started with the JWT entry point.