<div dir="ltr">ISSUE: <a href="https://issues.jboss.org/browse/KEYCLOAK-1222" target="_blank">https://issues.jboss.org/browse/KEYCLOAK-1222</a><br>PR: <a href="https://github.com/keycloak/keycloak/pull/1167" target="_blank">https://github.com/keycloak/keycloak/pull/1167</a><br><br>I provided a fix with a small modification in BearerTokenRequestAuthenticator.authenticateToken(HttpFacade exchange, String tokenString).<br><br>Please fix for 1.2 Final.<br><br><div class="gmail_quote">On Tue, Apr 21, 2015 at 12:46 PM Leonardo Loch Zanivan &lt;<a href="mailto:leonardo.zanivan@gmail.com" target="_blank">leonardo.zanivan@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Serialization works fine with BearerRequestAuthentication or Bearer/DirectLoginModule. The only problem is BasicAuthRequestAuthentication.<br></div><br>In RequestAuthentication.java, RefreshableKeycloakSecurityContext is created with Bearer.getTokenString(), but token string has Basic Auth credentials instead of access token.<br><br>I&#39;ll create a JIRA for this.<br></div></div><br><div class="gmail_quote">On Tue, Apr 21, 2015 at 4:17 AM Marek Posolda &lt;<a href="mailto:mposolda@redhat.com" target="_blank">mposolda@redhat.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>That&#39;s strange, serialization and
      deserialization of KeycloakSecurityContext should work fine.
      KeycloakSecurityContext actually uses java custom serialization
      (it implements writeObject and readObject methods). So during
      deserialization it calls readObject and creates AccessToken and
      IDToken from the base64 encoded token. This works fine in cluster
      and we also have the test for it:
      <a href="https://github.com/keycloak/keycloak/blob/master/core/src/test/java/org/keycloak/SkeletonKeyTokenTest.java#L58" target="_blank">https://github.com/keycloak/keycloak/blob/master/core/src/test/java/org/keycloak/SkeletonKeyTokenTest.java#L58</a>
      .<br>
      <br>
      If you still seeing issues and you think that it&#39;s bug, feel free
      to create JIRA. But please add the exact steps to reproduce to the
      JIRA.<br>
      <br>
      Thanks,<br>
      Marek</div></div><div bgcolor="#FFFFFF" text="#000000"><div><br>
      <br>
      On 21.4.2015 00:50, Leonardo Loch Zanivan wrote:<br>
    </div></div><div bgcolor="#FFFFFF" text="#000000"><blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Hi,<br>
              <br>
            </div>
            I&#39;m facing a problem while deserializing <span>KeycloakSecurityContext of a Basic Auth
              KeycloakAccount.<br>
              <br>
            </span><span>KeycloakSecurityContext stores
              Basic Auth base64 token instead of Access Token, so
              deserialization code fail!<br>
            </span><br>
            <span><b><span>String</span>[]
                parts <span>=</span> encoded<span>.</span>split(<span><span>&quot;</span><span>\\</span>.<span>&quot;</span></span>); <span>if</span>
                (parts<span>.</span>length <span>&lt;</span> <span>2</span>
                <span>||</span> parts<span>.</span>length
                <span>&gt;</span> <span>3</span>)
                <span>throw</span> <span>new</span>
                <span>IllegalArgumentException</span>(<span><span>&quot;</span>Parsing
                  error<span>&quot;</span></span>);</b><br>
              <a href="https://github.com/keycloak/keycloak/blob/master/core/src/main/java/org/keycloak/KeycloakSecurityContext.java" target="_blank">https://github.com/keycloak/keycloak/blob/master/core/src/main/java/org/keycloak/KeycloakSecurityContext.java</a><br>
            </span><span></span></div>
        </div>
        <span></span></div>
      <br>
      <fieldset></fieldset>
      <br>
      </blockquote></div><div bgcolor="#FFFFFF" text="#000000"><blockquote type="cite"><pre>_______________________________________________
keycloak-dev mailing list
<a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></pre>
    </blockquote>
    <br>
  </div>

</blockquote></div></blockquote></div></div>