question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vert.x gateway - help debugging KeycloakOAuthFactory - Access Token Error: null.

See original GitHub issue

Hi,

I am trying to deploy the Apiman 1.5.7.Final Vert.x gateway with external Elasticsearch and Keycloak.

When I try to check the gateway’s status, from the host on which it is running, I see:

$ curl -k -H 'Authorization: Basic YXBpbWFuYWdlcjphcGltYW4xMjMh' https://localhost:8081/apiman-gateway-api/system/status
Unauthorized

I have configured the gateway to only use HTTPS:

  "verticles": {
    "http": {
      "port": 8082,
      "count": 0
    },
    "https": {
      "port": 18443,
      "count": "auto"
    },
    "api": {
      "port": 8081,
      "count": 1
    }
  },

And the Keycloak configuration is:

  "auth": {
    "type": "keycloak",
    "config": {
      "flowType": "PASSWORD",
      "requiredRole": "realm:apipublisher",
      "realm": "management-optima",
      "auth-server-url": "https://${apiman.keycloak.server}:${apiman.keycloak.port}/auth",
      "ssl-required": "external",
      "disable-trust-manager": true,
      "allow-any-hostname" : false,
      "resource": "apiman-gateway-api",
      "credentials": {
        "secret": "a979e948-e17d-4ee6-8f50-ed6880a8b053"
      }
    }
  },

I have created an apimanger user, in the management-optima realm, with the password “apiman123!”. Using curl, I can retrieve a token for this user:

$ curl -k -H 'Authorization: Basic YXBpbWFuLWdhdGV3YXktYXBpOmE5NzllOTQ4LWUxN2QtNGVlNi04ZjUwLWVkNjg4MGE4YjA1Mw==' --data 'username=apimanager&password=apiman123!&grant_type=password' https://optima-sso-server:8190/auth/realms/management-optima/protocol/openid-connect/token | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2220  100  2161  100    59   9690    264 --:--:-- --:--:-- --:--:-- 10000
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI1Uzk2UVRMcDhFbFloZHd3MEFKQjFMQ2RUVHU5QkFocnVCdWtPbjZTcEEwIn0.eyJqdGkiOiI2YjZiMTdkYS0wNjc1LTRmODMtODcwNC1lYWYwM2ZiNmM4MjkiLCJleHAiOjE2MDU3NjI1NjksIm5iZiI6MCwiaWF0IjoxNjA1NzYyMjY5LCJpc3MiOiJodHRwczovL29wdGltYS1zc28tc2VydmVyOjgxOTAvYXV0aC9yZWFsbXMvbWFuYWdlbWVudC1vcHRpbWEiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiYmMyNTcyNmMtMTY5YS00ZTU4LTgzNmUtZjE4NWM1NjFjYjdlIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiYXBpbWFuLWdhdGV3YXktYXBpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiMzU5NjlhY2MtNWVmZS00ZmJmLThlZjUtNzJiNDFhYmY0ZDlmIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyIqIl0sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJhcGlwdWJsaXNoZXIiLCJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJhcGltYW5hZ2VyIn0.WwZVlJ-45b5pzlmvtQcXIO1_NXqeNuEamz-F4VJmi_lHPc3L6HqhczpCGupiI2Xq6gnfWhm-Q1iowrJWIwKP4sEwceXdG3QGhucTWlRL7qR6DR6SZxYMM1wyD-c3BFIKRWBYG38Kb7XLzd_MTzfop8DMgfTkDMNjVlYEo5hMwdQ",
  "expires_in": 300,
  "refresh_expires_in": 1800,
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJkNGI4Y2QwNS0yNWU4LTQ4ZWItYjk0OC1mZGNjNmZhYmM4ZjcifQ.eyJqdGkiOiJjZGY3ZDJlZS1lODY1LTQ5ODQtYTFiOC02OWU0OGU5YzA0ZWIiLCJleHAiOjE2MDU3NjQwNjksIm5iZiI6MCwiaWF0IjoxNjA1NzYyMjY5LCJpc3MiOiJodHRwczovL29wdGltYS1zc28tc2VydmVyOjgxOTAvYXV0aC9yZWFsbXMvbWFuYWdlbWVudC1vcHRpbWEiLCJhdWQiOiJodHRwczovL29wdGltYS1zc28tc2VydmVyOjgxOTAvYXV0aC9yZWFsbXMvbWFuYWdlbWVudC1vcHRpbWEiLCJzdWIiOiJiYzI1NzI2Yy0xNjlhLTRlNTgtODM2ZS1mMTg1YzU2MWNiN2UiLCJ0eXAiOiJSZWZyZXNoIiwiYXpwIjoiYXBpbWFuLWdhdGV3YXktYXBpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiMzU5NjlhY2MtNWVmZS00ZmJmLThlZjUtNzJiNDFhYmY0ZDlmIiwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbImFwaXB1Ymxpc2hlciIsIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6IiJ9.So-oILuKvXSFK5rSb4W2wCH5fetiqd56-myT1Ys7J_I",
  "token_type": "bearer",
  "not-before-policy": 0,
  "session_state": "35969acc-5efe-4fbf-8ef5-72b41abf4d9f",
  "scope": ""
}

In the gateway log, I see:

[DEBUG] 2020-11-19 18:34:29.941 [vert.x-eventloop-thread-1] SslHandler - [id: 0xfe8a5494, L:/127.0.0.1:8081 - R:/127.0.0.1:4603] HANDSHAKEN: TLS_ECDHE_RSA_WITH_AES_256_GCM_
SHA384
[DEBUG] 2020-11-19 18:34:29.960 [vert.x-eventloop-thread-1] ZlibCodecFactory - -Dio.netty.noJdkZlibDecoder: false
[DEBUG] 2020-11-19 18:34:29.960 [vert.x-eventloop-thread-1] ZlibCodecFactory - -Dio.netty.noJdkZlibEncoder: false
[DEBUG] 2020-11-19 18:34:30.018 [vert.x-eventloop-thread-1] OAuth2API - Fetching URL: https://optima-sso-server:8190/auth/realms/management-optima/protocol/openid-connect/t
oken
[DEBUG] 2020-11-19 18:34:30.090 [vert.x-eventloop-thread-1] SslHandler - [id: 0x351ad6e0, L:/10.176.13.243:4604 - R:optima-sso-server/10.176.13.243:8190] HANDSHAKEN: TLS_EC
DHE_RSA_WITH_AES_256_CBC_SHA384
[DEBUG] 2020-11-19 18:34:30.230 [vert.x-eventloop-thread-1] OAuth2ResponseImpl - New response: statusCode: 200
[DEBUG] 2020-11-19 18:34:30.234 [vert.x-eventloop-thread-1] OAuth2UserImpl - Cannot decode token:
java.lang.RuntimeException: Not enough or too many segments
        at io.vertx.ext.jwt.JWT.decode(JWT.java:259) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.decodeToken(OAuth2UserImpl.java:173) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.decodeToken(OAuth2UserImpl.java:147) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.init(OAuth2UserImpl.java:64) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.setAuthProvider(OAuth2UserImpl.java:91) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.<init>(OAuth2UserImpl.java:40) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2TokenImpl.<init>(OAuth2TokenImpl.java:55) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.flow.PasswordImpl.lambda$getToken$0(PasswordImpl.java:57) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.flow.AbstractOAuth2Flow.lambda$getToken$0(AbstractOAuth2Flow.java:142) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2API.lambda$null$1(OAuth2API.java:129) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.HttpClientResponseImpl$BodyHandler.notifyHandler(HttpClientResponseImpl.java:296) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.HttpClientResponseImpl.lambda$bodyHandler$0(HttpClientResponseImpl.java:196) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.HttpClientResponseImpl.handleEnd(HttpClientResponseImpl.java:252) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection$StreamImpl.endResponse(Http1xClientConnection.java:493) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection$StreamImpl.access$000(Http1xClientConnection.java:194) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection.handleResponseEnd(Http1xClientConnection.java:652) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection.handleHttpMessage(Http1xClientConnection.java:602) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection.handleMessage(Http1xClientConnection.java:560) ~[apiman-gateway.jar:?]
        at io.vertx.core.net.impl.ConnectionBase.handleRead(ConnectionBase.java:390) ~[apiman-gateway.jar:?]
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320) ~[apiman-gateway.jar:?]
        at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) ~[apiman-gateway.jar:?]
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:188) ~[apiman-gateway.jar:?]
        at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:174) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[apiman-gateway.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) ~[apiman-gateway.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[apiman-gateway.jar:?]
        at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1429) ~[apiman-gateway.jar:?]
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1199) ~[apiman-gateway.jar:?]
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1243) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[apiman-gateway.jar:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) ~[apiman-gateway.jar:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) ~[apiman-gateway.jar:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[apiman-gateway.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
[DEBUG] 2020-11-19 18:34:30.234 [vert.x-eventloop-thread-1] OAuth2UserImpl - Cannot decode token:
java.lang.RuntimeException: Not enough or too many segments
        at io.vertx.ext.jwt.JWT.decode(JWT.java:259) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.decodeToken(OAuth2UserImpl.java:173) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.decodeToken(OAuth2UserImpl.java:147) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.init(OAuth2UserImpl.java:72) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.setAuthProvider(OAuth2UserImpl.java:91) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2UserImpl.<init>(OAuth2UserImpl.java:40) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2TokenImpl.<init>(OAuth2TokenImpl.java:55) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.flow.PasswordImpl.lambda$getToken$0(PasswordImpl.java:57) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.flow.AbstractOAuth2Flow.lambda$getToken$0(AbstractOAuth2Flow.java:142) ~[apiman-gateway.jar:?]
        at io.vertx.ext.auth.oauth2.impl.OAuth2API.lambda$null$1(OAuth2API.java:129) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.HttpClientResponseImpl$BodyHandler.notifyHandler(HttpClientResponseImpl.java:296) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.HttpClientResponseImpl.lambda$bodyHandler$0(HttpClientResponseImpl.java:196) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.HttpClientResponseImpl.handleEnd(HttpClientResponseImpl.java:252) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection$StreamImpl.endResponse(Http1xClientConnection.java:493) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection$StreamImpl.access$000(Http1xClientConnection.java:194) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection.handleResponseEnd(Http1xClientConnection.java:652) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection.handleHttpMessage(Http1xClientConnection.java:602) ~[apiman-gateway.jar:?]
        at io.vertx.core.http.impl.Http1xClientConnection.handleMessage(Http1xClientConnection.java:560) ~[apiman-gateway.jar:?]
        at io.vertx.core.net.impl.ConnectionBase.handleRead(ConnectionBase.java:390) ~[apiman-gateway.jar:?]
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320) ~[apiman-gateway.jar:?]
        at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) ~[apiman-gateway.jar:?]
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:188) ~[apiman-gateway.jar:?]
        at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:174) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[apiman-gateway.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) ~[apiman-gateway.jar:?]
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[apiman-gateway.jar:?]
        at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1429) ~[apiman-gateway.jar:?]
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1199) ~[apiman-gateway.jar:?]
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1243) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411) ~[apiman-gateway.jar:?]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[apiman-gateway.jar:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[apiman-gateway.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[apiman-gateway.jar:?]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496) ~[apiman-gateway.jar:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) ~[apiman-gateway.jar:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) ~[apiman-gateway.jar:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[apiman-gateway.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
[ERROR] 2020-11-19 18:34:30.236 [vert.x-eventloop-thread-1] KeycloakOAuthFactory - Access Token Error: null.
[DEBUG] 2020-11-19 18:34:30.260 [vert.x-eventloop-thread-1] SslHandler - [id: 0xfe8a5494, L:/127.0.0.1:8081 - R:/127.0.0.1:4603] Swallowing a harmless 'connection reset by
peer / broken pipe' error that occurred while writing close_notify in response to the peer's close_notify

Searching for “vertx jwt Not enough or too many segments”, I came across a Vert.x issue wherein it was explained that the exception is not an error per se, which is why it is logged as a DEBUG message and not at a higher severity.

I am hoping that someone might be able to suggest where I am going wrong or what steps I might take to find the cause of the problem.

Thanks in advance

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
james-bostockcommented, Nov 23, 2020

Good point. I just looked at the main pom.xml and see that Apiman 1.5.7.Final uses Keycloak version 3.4.3.Final which is even older than the version of Keycloak that we are using (4.8.20 as a component of Red Hat SSO 7.3). For the Apiman manager, which we are deploying to Apache Tomcat 9.0, we are using version 4.8.3 of the Keycloak adapter and it does not require that the realm public key be present in the client configuration. So, quite possibly, this is something that changed between Keycloak versions 3.4 and 4.8.

0reactions
volkflocommented, Nov 25, 2020

I will refactor the Keycloak OAuth Policy in the near future because there you must also configure the certificate instead of using JWK(s). Maybe I can change the keycloak versions at the same time 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

OAuth2 auth provider - Eclipse Vert.x
The authorization code grant type is used to obtain both access tokens and refresh tokens and is optimized for confidential clients.
Read more >
io.vertx.ext.auth.oauth2.OAuth2Auth.getToken java ... - Tabnine
Decode a token to a AccessToken object. This is useful to handle bearer JWT tokens. getFlowType. Returns the configured flow type for the...
Read more >
[Java] agent transaction tracing in non-web Vert.x applications
I've looked at the docs and javadocs for the Agent API and asynchronous tracing however the current implementation requires the passing of Token...
Read more >
Example usage for io.vertx.core.json JsonObject ... - Java2s.com
List of usage examples for io.vertx.core.json JsonObject JsonObject ... KeycloakOAuthFactory.java ... getMessage(); log.error("Access Token Error: {0}.
Read more >
Chapter 4. Debugging Eclipse Vert.x based application
$ oc get dc. Set the JAVA_DEBUG environment variable in the deployment configuration of your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found