Hello All, I have successfully tested an application using Keycloak
1.9.0.CR1. I have also deployed same on a public IP. It works fine within
the LAN, but once you try to access it from the public the connetion times
out.
Please find below the logs;
20:43:06,191 ERROR [org.keycloak.adapters.OAuthRequestAuthenticator]
(default task-2) failed to turn code into token: java.net.ConnectException:
Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
[rt.jar:1.8.0_65]
at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
[rt.jar:1.8.0_65]
at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.ja
va:206) [rt.jar:1.8.0_65]
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
[rt.jar:1.8.0_65]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
[rt.jar:1.8.0_65]
at java.net.Socket.connect(Socket.java:589) [rt.jar:1.8.0_65]
at
org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFact
ory.java:117) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(Def
aultClientConnectionOperator.java:177) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
[httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnA
dapter.java:131) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequest
Director.java:611) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDir
ector.java:446) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.
java:863) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:82) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:106) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:57) [httpclient-4.5.1.jar:4.5.1]
at
org.keycloak.adapters.ServerRequest.invokeAccessCodeToToken(ServerRequest.ja
va:107) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.OAuthRequestAuthenticator.resolveCode(OAuthRequestAuth
enticator.java:314) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.OAuthRequestAuthenticator.authenticate(OAuthRequestAut
henticator.java:260) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.RequestAuthenticator.authenticate(RequestAuthenticator
.java:112) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.undertow.AbstractUndertowKeycloakAuthMech.keycloakAuth
enticate(AbstractUndertowKeycloakAuthMech.java:110)
[keycloak-undertow-adapter-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.undertow.ServletKeycloakAuthMech.authenticate(ServletK
eycloakAuthMech.java:92) [keycloak-undertow-adapter-1.9.0.CR1.jar:1.9.0.CR1]
at
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(Secur
ityContextImpl.java:283) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(Secur
ityContextImpl.java:300) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(Secur
ityContextImpl.java:270) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(Security
ContextImpl.java:133) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContext
Impl.java:108) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextIm
pl.java:101) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handl
eRequest(ServletAuthenticationCallHandler.java:55)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHa
ndler.java:33) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(
AuthenticationConstraintHandler.java:51)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(A
bstractConfidentialityHandler.java:46)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandle
r.handleRequest(ServletConfidentialityConstraintHandler.java:64)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handl
eRequest(ServletSecurityConstraintHandler.java:56)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(
AuthenticationMechanismsHandler.java:58)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.hand
leRequest(CachedAuthenticatedSessionHandler.java:70)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityI
nitialHandler.java:76) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequ
est(JACCContextIdHandler.java:61)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
org.keycloak.adapters.undertow.ServletPreAuthActionsHandler.handleRequest(Se
rvletPreAuthActionsHandler.java:69)
[keycloak-undertow-adapter-1.9.0.CR1.jar:1.9.0.CR1]
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(Servle
tInitialHandler.java:261) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletIn
itialHandler.java:248) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitial
Handler.java:77) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletIn
itialHandler.java:167) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:761)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
42) [rt.jar:1.8.0_65]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
17) [rt.jar:1.8.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_65]
21:00:44,500 ERROR [org.keycloak.adapters.OAuthRequestAuthenticator]
(default task-5) failed to turn code into token: java.net.ConnectException:
Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
[rt.jar:1.8.0_65]
at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
[rt.jar:1.8.0_65]
at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.ja
va:206) [rt.jar:1.8.0_65]
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
[rt.jar:1.8.0_65]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
[rt.jar:1.8.0_65]
at java.net.Socket.connect(Socket.java:589) [rt.jar:1.8.0_65]
at
org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFact
ory.java:117) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(Def
aultClientConnectionOperator.java:177) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
[httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnA
dapter.java:131) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequest
Director.java:611) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDir
ector.java:446) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.
java:863) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:82) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:106) [httpclient-4.5.1.jar:4.5.1]
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:57) [httpclient-4.5.1.jar:4.5.1]
at
org.keycloak.adapters.ServerRequest.invokeAccessCodeToToken(ServerRequest.ja
va:107) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.OAuthRequestAuthenticator.resolveCode(OAuthRequestAuth
enticator.java:314) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.OAuthRequestAuthenticator.authenticate(OAuthRequestAut
henticator.java:260) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.RequestAuthenticator.authenticate(RequestAuthenticator
.java:112) [keycloak-adapter-core-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.undertow.AbstractUndertowKeycloakAuthMech.keycloakAuth
enticate(AbstractUndertowKeycloakAuthMech.java:110)
[keycloak-undertow-adapter-1.9.0.CR1.jar:1.9.0.CR1]
at
org.keycloak.adapters.undertow.ServletKeycloakAuthMech.authenticate(ServletK
eycloakAuthMech.java:92) [keycloak-undertow-adapter-1.9.0.CR1.jar:1.9.0.CR1]
at
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(Secur
ityContextImpl.java:283) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(Secur
ityContextImpl.java:300) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(Secur
ityContextImpl.java:270) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(Security
ContextImpl.java:133) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContext
Impl.java:108) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextIm
pl.java:101) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handl
eRequest(ServletAuthenticationCallHandler.java:55)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHa
ndler.java:33) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(
AuthenticationConstraintHandler.java:51)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(A
bstractConfidentialityHandler.java:46)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandle
r.handleRequest(ServletConfidentialityConstraintHandler.java:64)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handl
eRequest(ServletSecurityConstraintHandler.java:56)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(
AuthenticationMechanismsHandler.java:58)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.hand
leRequest(CachedAuthenticatedSessionHandler.java:70)
[undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityI
nitialHandler.java:76) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequ
est(JACCContextIdHandler.java:61)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
org.keycloak.adapters.undertow.ServletPreAuthActionsHandler.handleRequest(Se
rvletPreAuthActionsHandler.java:69)
[keycloak-undertow-adapter-1.9.0.CR1.jar:1.9.0.CR1]
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.
java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(Servle
tInitialHandler.java:261) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletIn
itialHandler.java:248) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitial
Handler.java:77) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletIn
itialHandler.java:167) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:761)
[undertow-core-1.1.8.Final.jar:1.1.8.Final]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
42) [rt.jar:1.8.0_65]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
17) [rt.jar:1.8.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_65]
Show replies by date