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

Expose UsePath in the CamundaCloudClientBuilder for persisted token storage. #636

Closed
ShawnAbshire opened this issue Jan 20, 2024 · 6 comments · Fixed by #643
Closed

Expose UsePath in the CamundaCloudClientBuilder for persisted token storage. #636

ShawnAbshire opened this issue Jan 20, 2024 · 6 comments · Fixed by #643
Assignees
Labels

Comments

@ShawnAbshire
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Hello, recently started setting up lower test environments that point to a cloud instance of camunda 8 and ran into an issue where the library is attempting to persist tokens to disk for caching (.zeebe); however, this directory is read only in our environment and due to restrictions beyond my control I am unable to make it not read only; however, we do have a location that we would be able to write to.

I see there is a UsePath method on the ICamundaCloudTokenProviderBuilderFinalStep that isn't exposed via the ICamundaCloudClientBuilder and I don't see any other way of configuring the CamundaCloudTokenProviderBuilder.

Describe the solution you'd like
I would like to expose the UsePath on the the ICamundaCloudClientBuilder so we can properly configure where we'd like to persist our token cache.

Describe alternatives you've considered
Only alternative as of right now is to downgrade to before this change was implemented.

Additional context
No additional context.

@ShawnAbshire
Copy link
Contributor Author

Seeing a couple issues that stem from this configuration. Is there a way we can expedite patching this issue?

I assumed we could downgrade versions but having just looked through the history it seems even this isn't possible as it's always cached the tokens on disk.

@ChrisKujawa
Copy link
Collaborator

@ShawnAbshire have you tried to directly use the CamundaCloudTokenProviderBuilder() with the path? Like this https://github.com/camunda-community-hub/zeebe-client-csharp/blob/main/Client.IntegrationTests/ZeebeIntegrationTestHelper.cs#L240-L250

@ShawnAbshire
Copy link
Contributor Author

I have not, but looking into the builders I'm not seeing how this circumnavigates where the tokens are being saved to. I don't see any steps to configure the path.

@ChrisKujawa
Copy link
Collaborator

You can use UsePath not? https://github.com/camunda-community-hub/zeebe-client-csharp/blob/main/Client/Impl/Builder/CamundaCloudTokenProviderBuilder.cs#L78

The same you do in your PR? 🤔 https://github.com/camunda-community-hub/zeebe-client-csharp/pull/638/files

Example:




return ZeebeClient.Builder()
                .UseLoggerFactory(loggerFactory)
                .UseGatewayAddress(host)
                .UseTransportEncryption()
                .AllowUntrustedCertificates()
                .UseAccessTokenSupplier(
                    new CamundaCloudTokenProviderBuilder()
                        .UseAuthServer($"http://{keycloakContainer.Hostname}:{keycloakContainer.GetMappedPublicPort(KeycloakPort)}/auth/realms/camunda-platform/protocol/openid-connect/token")
                        .UseClientId("zeebe")
                        .UseClientSecret("sddh123865WUS)(1%!")
                        .UseAudience(audience)
                        .UsePath("/tmp/")  // <===== THIS
                        .Build())
                  .Build();

@ShawnAbshire
Copy link
Contributor Author

ShawnAbshire commented Jan 22, 2024

ah I see, sorry I had downgraded my package to 2.2.0 and so when inspecting didn't see the updated interface. Will attempt this solution.

@ShawnAbshire
Copy link
Contributor Author

This moves me forward, appreciate your response!

I still think it'd be nice to have the option on the cloud builder, but feel free to close if you think otherwise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment