How do I set the authenticated_user for the DBOS context with Java SpringBoot?

5 days ago 3
ARTICLE AD BOX

I'm using dev.dbos:transact:0.6+ with a SpringBoot api and Postgres database.

I've configured DBOS like this:

@SpringBootApplication public class MyApiApplication { public static void main(String[] args) { SpringApplication.run(MyApiApplication.class, args); String url = System.getenv("SPRING_DATASOURCE_URL"); String user = System.getenv("SPRING_DATASOURCE_USERNAME"); String pass = System.getenv("SPRING_DATASOURCE_PASSWORD") != null ? System.getenv("SPRING_DATASOURCE_PASSWORD") : ""; DBOSConfig config = DBOSConfig.defaults("my-app") .withDatabaseUrl(url) .withDbUser(user) .withDbPassword(pass); DBOS.configure(config); DBOS.launch(); } }

I'm trying to create a workflow and pass my JWT token sub claim as the authenticated user to the DBOS context so that it correctly shows up in the workflow_status table when it audits the step. I think it is possible to set the authenticated user with python or typescript frameworks but I don't see a way to do it with Java.

Read Entire Article