Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keycloak.json file in springboot application

Is it necessary to have a keycloak.json file even if we have configured everything in application.properties for a spring boot application.

like image 473
Sindhu Arju Avatar asked Nov 29 '18 06:11

Sindhu Arju


2 Answers

If you are using Spring Security Adapter, add bean KeycloakConfigResolver in your configuration file. It will use application.properties instead of WEB-INF/keycloack.json

@Bean
   public KeycloakConfigResolver KeycloakConfigResolver() {
      return new KeycloakSpringBootConfigResolver();
   }

See: https://developers.redhat.com/blog/2017/05/25/easily-secure-your-spring-boot-applications-with-keycloak/ Creating a SecurityConfig class section

like image 107
ehab refaat Avatar answered Nov 15 '22 23:11

ehab refaat


Assuming yours spring-boot application , if you are using keycloak-spring-boot-starter spring-boot adapter, Then you have all your configurations in application.properties.

You can find examples here https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-springboot

like image 40
ravthiru Avatar answered Nov 16 '22 01:11

ravthiru