OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.15k stars 591 forks source link

SVT: /metrics failed using microProfile-1.4 with JWT error #4692

Closed hanczaryk closed 6 years ago

hanczaryk commented 6 years ago

I've pulled down the latest build from https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/2018-08-17_1238/

I've setup my SVT ProShop application using new individual features implemented (mpFaultTolerance-1.1 & mpConfig-1.3) along with mpMetrics-1.1. I verified the application functionality and also that application fault tolerance metrics are shown at https://HOST:PORT/metrics

For this config, the following features are reported in the messages.log [8/17/18 9:52:18:097 EDT] 00000025 com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0012I: The server installed the following features: [jsp-2.3, mpFaultTolerance-1.1, ejbLite-3.2, servlet-4.0, ssl-1.0, jndi-1.0, cdi-2.0, localConnector-1.0, appSecurity-2.0, jdbc-4.1, mpConfig-1.3, el-3.0, concurrent-1.0, mpMetrics-1.1, json-1.0, distributedMap-1.0].

At this point, I've zipped the logs showing the successful requests.

Then, I stopped my server. Edited my server.xml where I removed the mpFaultTolerance-1.1 and mpConfig-1.3 features and instead used microProfile-1.4 which includes those features along with mulitple other features. The server started successfully with the messages.log reporting the following features [8/17/18 9:57:43:379 EDT] 00000025 com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0012I: The server installed the following features: [mpFaultTolerance-1.1, microProfile-1.4, servlet-4.0, ssl-1.0, jndi-1.0, cdi-2.0, mpHealth-1.0, appSecurity-2.0, jdbc-4.1, jaxrs-2.1, mpRestClient-1.1, mpMetrics-1.1, mpOpenTracing-1.1, jsp-2.3, ejbLite-3.2, localConnector-1.0, jsonp-1.1, mpConfig-1.3, jaxrsClient-2.1, el-3.0, concurrent-1.0, jwt-1.0, opentracing-1.1, mpJwt-1.1, json-1.0, mpOpenAPI-1.0, distributedMap-1.0].

Again, I verified the application functionality but this time when I attempted to go to https://HOST:PORT/metrics to verify fault tolerance metrics, I got the following error messages


[8/17/18 9:58:59:808 EDT] 00000077 com.ibm.ws.security.mp.jwt.tai.TAIJwtUtils E CWWKS5524E: The MicroProfile JWT feature encountered an error while creating a JWT by using the [defaultMpJwt] configuration and the token included in the request. CWWKS6031E: The JSON Web Token (JWT) consumer [defaultMpJwt] cannot process the token string. Unable to process JOSE object (cause: org.jose4j.lang.JoseException: Invalid JOSE Compact Serialization. Expecting either 3 or 5 parts for JWS or JWE respectively but was 1.): Basic YWRtaW46YWRtaW4= [8/17/18 9:58:59:808 EDT] 00000077 com.ibm.ws.security.mp.jwt.tai.MicroProfileJwtTAI E CWWKS5523E: The MicroProfile JWT feature cannot authenticate the request because a valid JWT cannot be created from the token included in the request. CWWKS5524E: The MicroProfile JWT feature encountered an error while creating a JWT by using the [defaultMpJwt] configuration and the token included in the request. CWWKS6031E: The JSON Web Token (JWT) consumer [defaultMpJwt] cannot process the token string. Unable to process JOSE object (cause: org.jose4j.lang.JoseException: Invalid JOSE Compact Serialization. Expecting either 3 or 5 parts for JWS or JWE respectively but was 1.): Basic YWRtaW46YWRtaW4=


After this issue is opened, I'll zip and upload the logs for both the successful individual feature attempt and the failed microProfile-1.4 feature attempt.

hanczaryk commented 6 years ago

I've zipped and uploaded the two sets of logs and the server.xml to http://rtpgsa.ibm.com/home/h/a/hanczar/web/public/testRep/bugs/4692/8-17/

The only server.xml modification between the two attempts is the change in features used (mpFaultTolerance-1.1 & mpConfig-1.3 vs microProfile-1.4).

chunlongliang-ibm commented 6 years ago

Will update code not to enforce mpJwt-1.1 if mpConfig does not contain required JWT properties

hanczaryk commented 6 years ago

FYI, I verified that this issue was fixed using the wlp-20180820-0500 build.