Does @DgsQuery work with @EnableReactiveMethodSecurity and @PreAuthorize or @Secured #381
Replies: 3 comments 4 replies
-
@rthomsenshiftconnect the first issue is that Flux/Mono wasn't supported as a return type yet. There is an issue about this, where I replied with a possible PR: #376. I've not looked into |
Beta Was this translation helpful? Give feedback.
-
I think #375 (comment) is on the same note as this discussion. I think there is a way to do it with a small change to DataFetcherResultProcessor , by providing the DFE into it; but not sure what peoples opinions are on that. |
Beta Was this translation helpful? Give feedback.
-
I tested it with |
Beta Was this translation helpful? Give feedback.
-
I am using graphql-dgs-webflux-starter and EnableReactiveMethodSecurity to protect my Spring Boot endpoints; When I add @PreAuthorize("isAuthenticated()") to a RestController mapping, it works as expected. However, when I add it a method annotated with @DgsQuery I get the following error:
The returnType class java.util.concurrent.CompletableFuture on public java.util.concurrent.CompletableFuture com.company.endpoint.UserEndpoint.getUser() must return an instance of org.reactivestreams.Publisher (i.e. Mono / Flux) or the function must be a Kotlin coroutine function in order to support Reactor Context
If I change the return type on the method annotated with @DgsQuery to a Flux I get the following error:
Can't resolve value (/getUser) : type mismatch error, expected type LIST got class reactor.core.publisher.MonoFlatMapMany
Are @DgsQuery and @EnableReactiveMethodSecurity compatiable?
Thanks in advance.
Rick
Beta Was this translation helpful? Give feedback.
All reactions