<div dir="ltr">Doesn&#39;t sound like you have working clustering setup. Please take a look at <a href="https://keycloak.gitbooks.io/server-installation-and-configuration/content/topics/clustering.html">https://keycloak.gitbooks.io/server-installation-and-configuration/content/topics/clustering.html</a>.</div><div class="gmail_extra"><br><div class="gmail_quote">On 18 September 2016 at 04:15, <a href="mailto:i.pop@centurylink.net">i.pop@centurylink.net</a> <span dir="ltr">&lt;<a href="mailto:i.pop@centurylink.net" target="_blank">i.pop@centurylink.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000">Hi ,<div>I work on POC to use Keycloak to secure a set of microservices( java written SpringBooth&amp;gradle projects).</div><div>I use Keycloak-2.1.0.Final release installed on 3 different VMs(master running on VM1, slave1 on VM2, slave2 on VM2). <span style="font-size:12pt">On a 4th VM I have installed a shared (MySql) db to replace the embedded H2 db.</span></div><div><span style="font-size:12pt">I have configured a Keycloak Domain Mode cluster using keycloak documentation &quot;Server Installation and Configuration Guide&quot;.</span></div><div></div><div>1. I have logged on the master keycloak server and configured my new Realm that has my microservice processes  as clients.I have added roles,users,groups, etc., The realm configuration of the master keycloak instance  got replicated on the slave instances ( I can see the cluster running when loging-on  WildFly Management Interface).</div><div>2. I have added to all microservice java projects the  keycloak securing code: </div><div>    2.1 Created a keycloak.json file who&#39;s content was generated my the MASTER keycloak server(Client&#39;s &quot;Installation&quot; utility)</div><div>    2.2 Added to the  project&#39;s Application class a  system property, to target the keycloak.json file generated by the MASTER keycloak             instance:<span style="font-size:12pt">System.setProperty(&quot;<wbr>keycloak.configurationFile&quot;, &quot;classpath:keycloak.json&quot;);</span></div><div>    2.3 Created a new config&#39;s package class : public class SecurityConfig extends KeycloakWebSecurityConfigurerA<wbr>dapter</div><div>    2.4  Added to the build.gradle file keycloak spring security adapter compilation : </div><div>           compile group: &#39;org.keycloak&#39;, name:&#39;keycloak-spring-<wbr>security-adapter&#39;,version:&#39;2.<wbr>1.0.Final</div><div>  Note. I have compared the content of the json format code generated by the Client &quot;Installation&quot; utility of the slave instances against master instance and, THE ONLY DIFFERENCE is the<b> &quot;auth-server-url&quot;</b> line (having the specific node URL address) </div><div>3. Now, I want to do the test of accessing particular resources of my microservice applications(additional info: I did not implemented any load-balancer in front of the keycloak cluster): </div><div>     I have created a simple java program that uses a Basic Authorization  procedure to get an access token, and then use this token to sent request messages to my microservice application and get the expected response messages.</div><div>   - When I use the MASTER&#39;s instance authorization endpoint to get an access token, I get the expected response message( because, I presume,  my microservice application attached  keycloak.json file has HARDCODED content  generated by the MASTER&#39;s instance &amp; containing MASTERS&#39;s authorization endpoint).</div><div>    - When I use either-one SLAVE keycloak instance authorization&amp;token generation endpoint to generate an access token, my request  fails with a 401 error:<span style="font-size:12pt">&quot;Unable to authenticate bearer token&quot;</span></div><div>I believe or feel, I use a wrong approach to solve my problem. My microservice applications (at this time)  DO NOT KNOW anything, whether I use a domain mode cluster  or, a simple standalone keycloak instanceattached keycloak.json file has ONLY one keycloak instance (<span style="font-size:12pt">MASTER&#39;s</span><span style="font-size:12pt"> )</span><span style="font-size:12pt">  &quot;auth-server-url&quot;  info ).</span></div><div>Here, I need your help to enlighten me. Is there another approach to handle my problem? It should, otherwise why writing about Domain Mode in Keycloak Release documentation. Unfortunately, I have not found (yet )  detailed  info on how to configure a Keycloak Domain Cluster and how to do test simulations with it. I would appreciate any help on this issue.</div><div>Thanks,</div><div>Ioan  </div><div> </div><div>           </div></div></div><br>______________________________<wbr>_________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>