@onobc PulsarPropertiesMapper.getAuthenticationParamsJson does not return a proper Json encoded in String after this change https://github.com/spring-projects/spring-boot/commit/41ed4d6cf4c5e316f236c99ce59cf7ddfa48ee89 because values are not properly encoded.

Comment From: onobc

Hi @adrianiacobghiula

Thanks for the report. Can you please provide a sample yml that contains the spring.pulsar.client.authentication properties that are failing to encode properly?

Comment From: adrianiacobghiula

There is a custom authentication plugin that requires a JWK An example like:

spring:
  application:
    name: pulsar-authentication
  pulsar:
    client:
      service-url: pulsar://localhost:6650
      authentication:
        plugin-class-name: aig.pulsar.AuthenticationPlugin
        param:
          client-id: pulsar-admin
          private-key: |
            {
              "kty" : "RSA",
              "kid" : "cc34c0a0-bd5a-4a3c-a50d-a2a7db7643df",
              "use" : "sig",
              "n"   : "valueN",
              "e"   : "AQAB",
              "d"   : "valueD",
              "p"   : "valueP",
              "q"   : "valueQ",
              "dp"  : "valueDP",
              "dq"  : "valudDQ",
              "qi"  : "valueQI"
            }

the encodedAuthParamString looks like this:

{"client-id":"pulsar-admin","private-key":"{
  "kty" : "RSA",
  "kid" : "cc34c0a0-bd5a-4a3c-a50d-a2a7db7643df",
  "use" : "sig",
  "n"   : "valueN",
  "e"   : "AQAB",
  "d"   : "valueD",
  "p"   : "valueP",
  "q"   : "valueQ",
  "dp"  : "valueDP",
  "dq"  : "valudDQ",
  "qi"  : "valueQI"
}
"}

not a proper encoded JSON

Comment From: philwebb

@adrianiacobghiula valueP is missing an opening quote in your YAML. Is that the problem?

Comment From: adrianiacobghiula

@philwebb the missing opening quote is not a problem. I updated the example to include the quote and re-executed the test. It still fails as the value is obviously not json encoded

Comment From: onobc

@philwebb when I did https://github.com/spring-projects/spring-boot/commit/41ed4d6cf4c5e316f236c99ce59cf7ddfa48ee89 I did not account for custom auth modules whose param values would need to be encoded. I am not sure what/how ObjectMapper was encoding that value string but I think we just need to add some simple encoding on the values.

Comment From: philwebb

Closing in favor of PR #40493