title: Keycloak stuck in loop after login
body: <p>I have setup <code>Keycloak</code> as an IdP for SSO using SAML2.0. I have registered my client at <code>Keycloak</code> with the needed URLs:<br/>
  <em>Master SAML Processing URL:</em> <code><a href="http://localhost:8085/myapp/saml" rel="nofollow noreferrer">http://localhost:8085/myapp/saml</a></code>
  Althought it's not necessary when I have the master URL set:
  I have <code>ACS URL POST Binding</code>, <code>Logout URL POST Binding</code> both set to: <code><a href="http://localhost:8085/myapp/saml" rel="nofollow noreferrer">http://localhost:8085/myapp/saml</a></code><br/>
  <code>Root URL:</code> <code><a href="http://localhost:8085/myapp" rel="nofollow noreferrer">http://localhost:8085/myapp</a></code></p>
  
  <p>When I try to access a protected resource i.e., a URL of the form 
  <code><a href="http://localhost:8085/myapp/protected/" rel="nofollow noreferrer">http://localhost:8085/myapp/protected/</a>*</code>, <code>Keycloak</code> redirects me to its login page. Now, when I get a hit on my ACS URL after successful login, I try to redirect the page to one of protected resources. 
  Doing this: <code>resp.sendRedirect("<a href="http://localhost:8085/myapp/protected/home.html" rel="nofollow noreferrer">http://localhost:8085/myapp/protected/home.html</a>");</code>.</p>
  
  <p>Now, Keycloak again redirects me to login page and then gets stuck in an infinite loop.</p>
  
  <p>My <code>web.xml</code> config is: </p>
  
  <pre><code>  &lt;filter&gt;
      &lt;filter-name&gt;Keycloak Filter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.keycloak.adapters.saml.servlet.SamlFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;Keycloak Filter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/protected/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>-Some people got it resolved by ending the Master URL with <code>/saml</code> that I already have.<br/>
  -I also tried putting <code>/rest</code> at the end of ACS URL, but nothing works</p>
  
  <p>It just shows <code>Your are already logged in</code> or just keeps redirecting</p>