[Java] How do you submit a command to create or exercise a choice with user management

Hi team,

How do you submit a command in Java using the User management?

Thanks and regards,

As of 2.4.0, all Java bindings methods have an overload that allows to pass in an access token. If the access token comes in the format expected for user tokens instead of custom claim tokens, the claims for the user will be read from the ones existing for the user as recorded through the UserManagementService.


Amazing, thanks @stefanobaghino-da !

This means that there is no other way in 2.4.0 to submit as the user besides JWT ?

No, the access token is how you authorize calls. Were you after something else in particular?

1 Like

Just to make this explicit: Passing the access token does not remove the need to specify the actAs/readAs parties. You always need to specify those explicitly. User management only allows you to use a token for a user and the ledger will then validate that the parties you specified are within the rights associated with your user.

1 Like

I just wanted to explore the different options and know if there is a Daml script equivalent of the submitUser and use directly the class User.

@cocreature, noted with thanks !

Would you please have a code example @cocreature ?

For what exactly? There is nothing special about a submission using user management from the Java bindings side. You still have to specify parties. quickstart-java contains a command submission if that’s what you’re looking for daml/IouMain.java at 58727f55801f14649ecb83e367708aaaf2b89b6a · digital-asset/daml · GitHub