Skip to content
Discussions/App Development/[Java] How do you submit a command to create or exercise a choice with user managementForum ↗

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

App Development9 posts264 views4 likesLast activity Oct 2022
JA
jaypeedaOP
Oct 2022

Hi team,

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

Thanks and regards,
Jean-Paul

ST
stefanobaghino-da
Oct 2022

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.

JA
jaypeeda
Oct 2022

Amazing, thanks @stefanobaghino-da !

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

ST
stefanobaghino-da
Oct 2022

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

CO
cocreature
Oct 2022

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.

JA
jaypeeda
Oct 2022

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 !

JA
jaypeeda
Oct 2022

Would you please have a code example @cocreature ?

CO
cocreature
Oct 2022

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

JA
jaypeeda
Oct 2022

Thanks

← Back to Discussions