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

PulsarClientOauthAuthenticationService Private key file field doesn't support Base64 encoded value. #85

Open
olavgg opened this issue May 30, 2024 · 1 comment

Comments

@olavgg
Copy link

olavgg commented May 30, 2024

Instead of creating a file for nifi, you should be able to add a base64 encoded value

This works with the Pulsar Client

String oauth2Creds = "{" +
                "\"type\":\"client_credentials\"," +
                "\"client_id\": \"" + clientId + "\"," +
                "\"client_secret\": \"" + clientSecret + "\"," +
                "\"issuer_url\": \"" + issuerUrl + "\"" +
                "}";
        String base64data = Base64.getEncoder().encodeToString(oauth2Creds.getBytes());
        String json = "{" +
                "\"type\":\"client_credentials\"," +
                "\"privateKey\":\"data:application/json;base64," + base64data + "\"," +
                "\"issuerUrl\":\"" + issuerUrl + "\"," +
                "\"audience\":\""+audience+"\"" +
                "}";
        var auth = AuthenticationFactory .create(AuthenticationOAuth2.class.getName(), json);
        
        client = PulsarClient.builder()
                        .serviceUrl(myPulsarUrl)
                        .authentication(auth)
                        .build();
@david-streamlio
Copy link
Owner

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants