Uploaded image for project: 'Hawkular'
  1. Hawkular
  2. HAWKULAR-648

"failed to turn code into token" when securing UI webapp

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.0.0.Alpha6
    • None
    • _am_uncertain
    • None
    • Hide

      1) Deploy the attached test ui war into the Hawkular accounts distribution

      2) Edit the standalone.xml to include:

      <secure-deployment name="hawkular-ui-test.war">
      <realm>hawkular</realm>
      <resource>hawkular-ui</resource>
      <credential name="secret">320644a1-6a8b-4eb7-86ed-e84a42db6d8d</credential>
      </secure-deployment>

      with the secret set to the appropriate value from the hawkular realm.

      3) Start the server at port offset 100

      4) Point a browser at http://localhost:8180/hawkular-ui-test

      Show
      1) Deploy the attached test ui war into the Hawkular accounts distribution 2) Edit the standalone.xml to include: <secure-deployment name="hawkular-ui-test.war"> <realm>hawkular</realm> <resource>hawkular-ui</resource> <credential name="secret">320644a1-6a8b-4eb7-86ed-e84a42db6d8d</credential> </secure-deployment> with the secret set to the appropriate value from the hawkular realm. 3) Start the server at port offset 100 4) Point a browser at http://localhost:8180/hawkular-ui-test

    Description

      Experiencing an exception when I deploy a secured UI webapp in a server using a port offset (e.g. 100). The exception doesn't occur if no port offset is used.

      When port offset is used, and no server is running at port 8080, I get:

      09:49:57,868 ERROR [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-7) failed to turn code into token: java.net.ConnectException: Connection refused
              at java.net.PlainSocketImpl.socketConnect(Native Method)
              at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
              at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
              at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
              at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
              at java.net.Socket.connect(Socket.java:589)
              at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
              at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
              at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
              at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
              at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
              at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
              at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
              at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
              at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
              at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
              at org.keycloak.adapters.ServerRequest.invokeAccessCodeToToken(ServerRequest.java:122)
              at org.keycloak.adapters.ServerRequest.invokeAccessCodeToToken(ServerRequest.java:95)
              at org.keycloak.adapters.OAuthRequestAuthenticator.resolveCode(OAuthRequestAuthenticator.java:296)
              at org.keycloak.adapters.OAuthRequestAuthenticator.authenticate(OAuthRequestAuthenticator.java:244)
              at org.keycloak.adapters.RequestAuthenticator.authenticate(RequestAuthenticator.java:90)
              at org.keycloak.adapters.undertow.AbstractUndertowKeycloakAuthMech.keycloakAuthenticate(AbstractUndertowKeycloakAuthMech.java:114)
      .....
      

      Whereas if another server happens to be running at port 8080, the message reports a status of 404 (i.e. page not found).

      So appears that the Keycloak adapter is attempting to use the default port.

      Attachments

        Activity

          People

            jpkroehling@redhat.com Juraci Paixão Kröhling (Inactive)
            gary@brownuk.com Gary Brown
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: