Spring Boot | Keycloak

Implementing and Securing a simple Spring Boot UI using Keycloak for IAM

Step-by-step guide on implementing Simple UI with Thymeleaf, securing it using RBAC and Keycloak for Identity and Access Management

Ivan Franchin
JavaToDev
Published in
13 min readJun 15, 2023

--

Photo by Collin on Unsplash

In this article, we will implement a Simple Spring Boot application called Simple UI. This application has a User Interface (UI) built with Thymeleaf and utilizes Role-Based Access Control (RBAC) to restrict access to specific pages based on user privileges. To handle authentication and authorization, we will be using Keycloak.

Let’s get started!

Simple UI Roles and Pages

The Simple UI application defines two roles: SIMPLE-UI-ADMIN and SIMPLE-UI-USER. These roles are used to restrict access to certain pages based on user privileges. Additionally, Thymeleaf is used to integrate dynamic content and role-based access control within the HTML templates.

The Simple UI application comprises six pages, each with specific role requirements:

  • index.html, login.html and public-page.html are public pages accessible to everybody;
  • admin-page.html can only be accessed by individuals with the…

--

--

Ivan Franchin
JavaToDev

Lead Software Developer with BS and MS in Computer Science. Writing about Java, Spring, software development in general, and emerging technologies.