Keycloak Embedded in a Spring Boot Application
1. Overview Keycloak is an open-source Identity and Access Management solution administered by RedHat, and developed in Java by JBoss. Keycloak can also be run as a standalone server, but then it involves downloading it and setup via the Admin Console. 2. Keycloak Pre-Configuration To start with, let's understand how we can pre-configure a Keycloak server. The server contains a set of realms, with each realm acting as an isolated unit for user management. To pre-configure it, we need to specify a realm definition file in a JSON format. Everything that can be configured using the Keycloak Admin Console is persisted in this JSON. Our Authorization Server will be pre-configured with baeldung-realm.json. Let's see a few relevant configurations in the file: users: our default users would be john@test.com and mike@other.com; they'll also have their credentials here clients: we'll define a client with the id newClient standardFlowEnabled: set to true to activate Authorizat