This is the last blog of the series of securing spring boot application with keycloak. It is recommended to go through this first blog and second blog here.
In last blog post of this series we saw how we can configure keycloak for our application. Now in this tutorial we will see how we can use keycloak with spring boot.
Prerequisite
Docker Keycloak Version
Spring Boo: 1.5.17.RELEASE Java: 1.
Setup Realm and clients in keycloak
This blog is the second part of the series of security spring boot application with keycloak. In first part we install setup in keycloak with docker you can see first part here
Version:
Keycloak: 4.5.0.Final Pre-requisites Keycloak should be installed in the Create realm A realm secures and manages security metadata for a set of users, applications, and registered oauth clients. Users can be created within a specific realm within the Administration console.
Introduction
In this article we will see example of how to secure a spring boot rest application with Spring Boot2, Spring Security, Oauth2, and JWT token.
1. Source Code Repository
The code used in this article is available in this repository GitHub.
2. Dependencies
2.1. Versions
Spring Boot: 2.1.3.RELEASE Java: 1.8 3. Entity Class
We create two Entity Classes, one is User and another is Role. User entity class contains user details like name, password, roles details, and role entity contains the role details.