Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.32k stars 1.97k forks source link

[FEATURE REQ] CosmosDB Spring Data Auditor ReactiveAuditorAware support #42115

Open petercooperjr-spls opened 7 hours ago

petercooperjr-spls commented 7 hours ago

Is your feature request related to a problem? Please describe. Using Spring WebFlux, we store the authenticated user in the Reactive context. We would like to be able to automatically write this user to the @LastModifiedBy field in our Cosmos entities. This should be pretty straightforward since Spring Data has an Auditor concept, which this SDK enables with @EnableCosmosAuditing. However, that only looks for a bean that implements AuditorAware, which doesn't support getting information from the Reactive context but is designed for getting information out of some sort of thread-local store or the like.

Describe the solution you'd like I'm looking for something along the lines of @EnableReactiveCosmosAuditing, which looks for a bean implementing the ReactiveAuditorAware interface instead. For example, with Spring Data for MongoDB, there is a @EnableReactiveMongoAuditing in addition to @EnableMongoAuditing.

Describe alternatives you've considered We could work around it by adding code to each time we save that looks up the current user in the reactive context and sets our modified-by field directly. But it would be much more convenient to just use the Spring Data auditing support which is already there.

Thank you!

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

github-actions[bot] commented 7 hours ago

@moarychan @netyyyy @rujche @saragluna

github-actions[bot] commented 7 hours ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.