<div dir="ltr"><div>Hi Team,</div><div><br></div><div>I have some query on multi tenancy.</div><div><br></div><div>Scenario:</div><div><br></div><div>a)</div><div>I have a webservice (named: SampleService) that is to be shared across multi tenants , i.e in other words, the service will be present in multiple realms.</div><div><br></div><div>The number of realms are dynamic, they can be increased based on new client onboard.</div><div><br></div><div>Configuration: </div><div>I have multiple keycloak.json files present in resource folder of SampleService such as:</div><div>realm1-keycloak.json</div><div>realm2-keycloak.json.</div><div><br></div><div>TO resolve this multiple jsons, I have a path resolver in web.xml of SampleService:</div><div> &lt;context-param&gt;</div><div>        &lt;param-name&gt;keycloak.config.resolver&lt;/param-name&gt;</div><div>        &lt;param-value&gt;com.crunchify.restjersey.PathBasedKeycloakConfigResolver&lt;/param-value&gt;</div><div>    &lt;/context-param&gt;</div><div><br></div><div><br></div><div>b)</div><div>I have a UI application, that gets authenticated by calling the the service to get the token:</div><div>example</div><div>new HttpPost(KeycloakUriBuilder.fromUri(&quot;<a href="http://localhost:8080/auth">http://localhost:8080/auth</a>&quot;)</div><div><span class="" style="white-space:pre">                                        </span>.path(ServiceUrlConstants.TOKEN_PATH).build(realmName));</div><div><br></div><div>Now My question is. I have the token for a particular realm(say realm1) and I want to call the SampleService using that token. How will SampleService come to know which keycloakJson to use to resolve the token validation:</div><div><br></div><div>Note my service call URI doesn&#39;t change as per realm: example:</div><div>URI are</div><div>localhost:8080/sampleService/getRequsitionDetails</div><div>or</div><div>localhost:8080/sampleService/postRequsitionDetails</div><div><br></div><div>and not</div><div><br></div><div>localhost:8080/sampleService/realm1/getRequsitionDetails</div><div>or</div><div>localhost:8080/sampleService/realm2/postRequsitionDetails.</div><div><br></div><div><br></div><div>Kindly respond to the above case.</div><div><br></div><div>Please let me know in case of any issues.</div></div>