title: How to configure multiple Keycloak sso clients in spring-boot application?
body: <p>I am configuring Keycloak SSO with spring boot micro-services. I want multiple keycloak clients to access spring boot services. If Keycloak adapter is used in spring boot application <code>pom.xml</code> then required properties supports only one client and secret. How can we add multiple clients in spring boot app at runtime?</p>
  <p>I have used following adapter in <code>pom.xml</code></p>
  <pre class="lang-maven prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;org.keycloak.bom&lt;/groupId&gt;
      &lt;artifactId&gt;keycloak-adapter-bom&lt;/artifactId&gt;
      &lt;version&gt;5.0.0&lt;/version&gt;
      &lt;type&gt;pom&lt;/type&gt;
      &lt;scope&gt;import&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>The following is configured in <code>application.properties</code></p>
  <pre><code>keycloak.auth-server-url=http://localhost:9080/auth
  keycloak.realm=test
  keycloak.ssl-required=external
  keycloak.resource=rest-api
  keycloak.credentials.secret=62s4376d-9b45-4aa3-abcb-1abdefc4fab88
  keycloak.use-resource-role-mappings = true
  keycloak.security-constraints[0].authRoles[0]=rest-api
  keycloak.security-constraints[0].securityCollections[0].patterns[0]=/api/*
  </code></pre>
  <p>Above properties support only one client configuration and only allow token generated by client rest-api which is added in <code>application.properties</code>.</p>
  <p>I want to create client in Keycloak dynamically and want spring-boot application to allow token generated by all the clients.</p>
  <p>Dynamic client registration is available for spring boot oAuth2 configuration but could not find any example with keycloak multiple clients configured in spring boot application</p>
  <p>It will be helpful if anybody has solved similar requirement and would like to share configuration or example.</p>