Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PulsarPropertiesMapper.getAuthenticationParamsJson #40492

Closed
adrianiacobghiula opened this issue Apr 23, 2024 · 6 comments · May be fixed by #40493
Closed

PulsarPropertiesMapper.getAuthenticationParamsJson #40492

adrianiacobghiula opened this issue Apr 23, 2024 · 6 comments · May be fixed by #40493
Labels
status: superseded An issue that has been superseded by another

Comments

@adrianiacobghiula
Copy link

adrianiacobghiula commented Apr 23, 2024

@onobc
PulsarPropertiesMapper.getAuthenticationParamsJson does not return a proper Json encoded in String
after this change 41ed4d6 because values are not properly encoded.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 23, 2024
@onobc
Copy link
Contributor

onobc commented Apr 23, 2024

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?

@scottfrederick scottfrederick added the status: waiting-for-feedback We need additional information before we can continue label Apr 23, 2024
@adrianiacobghiula
Copy link
Author

adrianiacobghiula commented Apr 23, 2024

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

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 23, 2024
@philwebb
Copy link
Member

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

@philwebb philwebb added the status: waiting-for-feedback We need additional information before we can continue label Apr 23, 2024
@adrianiacobghiula
Copy link
Author

@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

@spring-projects-issues spring-projects-issues removed the status: waiting-for-feedback We need additional information before we can continue label Apr 23, 2024
@onobc
Copy link
Contributor

onobc commented Apr 23, 2024

@philwebb when I did 41ed4d6 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.

onobc added a commit to onobc/spring-boot that referenced this issue Apr 23, 2024
The values in the `spring.pulsar.client.authentication.param`
config props map are not currently JSON encoded. For simple
values this is fine. However, some custom auth modules may
require more complex parameter values that may contain special
characters that results in invalid JSON. This commmit encodes
the parameter values using a very simple hand-rolled escape
function.

Fixes spring-projects#40492
@philwebb
Copy link
Member

Closing in favor of PR #40493

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2024
@philwebb philwebb added status: superseded An issue that has been superseded by another and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants