Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signing key cannot be found

Using http://jwtenizr.sh/ to generate the jwt microprofile configuration. Adding the microprofile-config.properties file works perfectly with quarkus but when trying with openliberty I get the following errror:

CWWKS5523E: The MicroProfile JWT feature cannot authenticate the request because a valid JWT cannot be created from the token included in the request. CWWKS6029E: The JSON Web Token (JWT) cannot be validated because a signing key cannot be found. The configured signature algorithm [RS256] requires a key to validate the token.

My server.xml is as follow:

<?xml version="1.0" encoding="UTF-8"?>
<server description="${project.artifactId}">

   <featureManager>
      <feature>mpJwt-1.1</feature>
      <feature>jaxrs-2.1</feature>
      <feature>cdi-2.0</feature>
      <feature>mpConfig-1.3</feature>
      <feature>mpOpenAPI-1.0</feature>
      <feature>appSecurity-2.0</feature>
   </featureManager>

   <httpEndpoint id="defaultHttpEndpoint"
      httpPort="${httpPort}" httpsPort="${httpsPort}" />

   <application location="${project.build.finalName}.war" />

   <logging traceSpecification="${log.name}.*=${log.level}" />

</server>

microprofile-config.properties

mp.jwt.verify.issuer=airhacks
mp.jwt.verify.publickey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgNSR7iZWlwOvJFyDFsva5XxUmRkBl3EjUn1OlV+jBj3LngKXBIujwAGCXYw+wr9JGJglmaOITqHtrow4j0T1wVGQF4cgN1o+FtcYyeDVsk+Ji3T3PaIIedgfzn1ufQUyWoeJAeROxmMOydImJeSe1o8VEP/ulvBAqq9IlJ2fw1Q521IE4geG5LywTSY/SdFo5zSs7sewNbZYKAguODEBQJNI85xe64mBwBKN2CKxVrwzq6plaVVBlityIcJLvh/pEXaBdnrEUXSfy4+Bf4jCIAUEV0O3GAR27fU5+tWdoHW0PIjjZ5W86D55JH+YWYOGQ06e+irLgHKxVNTIvpjE2QIDAQAB

Do I need to add a keystore? If so why would this be required?

like image 977
BeCodeMonkey Avatar asked Mar 21 '26 02:03

BeCodeMonkey


1 Answers

I don't know, why configuration with mp.jwt.verify.publickey string doesn't work in OpenLiberty.

Anyway, I managed to make it working in this way:

microprofile-config.properties

mp.jwt.verify.issuer=airhacks
mp.jwt.verify.publickey.location=/META-INF/public-key.pem

public-key.pem

-----BEGIN PUBLIC KEY-----
MIIBIj... <public key>
-----END PUBLIC KEY-----
like image 186
srnjak Avatar answered Mar 22 '26 19:03

srnjak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!