AuthorizationTokenSupplier queries

Hi Experts,

Can a function be passed as a AuthorizationTokenSupplier , for eg:

AuthorizationTokenSupplier tokenSupplier = () -> return restTemplate.get("http-endpoint-which-returns-jwt-tokens");

Also, in one scenario, I’ll be getting the token from the caller of workflow, is it possible to provide that token in the above supplier?

You can define your custom AuthorizationTokenSupplier, for example:

public class MyAuthorizationTokenSupplier implements AuthorizationTokenSupplier { ... }

and pass it to AuthorizationGrpcMetadataProvider that you register with WorkflowServiceStubsOptions.

I’ll be getting the token from the caller of workflow

Not sure what this means but in your custom AuthorizationTokenSupplier you could provide means for the token to be set/updated by the information you get from the caller.
Hope this helps.

1 Like