Spring boot project integrated with keycloak. Small sample thal talks about how to integrate keycoak with spring boot module
To enable support for Keycloak security following things needs to be added.
- Setup a keycloak server
- Add dependecies for keycloak (Refer build.gradle)
- Keycloak provides an implementation of spring security Refer keycloakSecurity.xml in the resource folder
- Inside the above xml we provide the intercept urls and roles which possibly have access to the url
- In the controller, we have provided two endpoints /echo which will be accessible to everyone and /secured_echo which will be accesible only for authenticated users
- KeycloakSecurity.xml requires keycloak.json which can be found under resources. This keycloak.json is pretty much empty in this case, you can get your own once you set up the keycloak and add your clients