You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a ReactiveSecurityEvaluationContextExtension (similar to the existing SecurityEvaluationContextExtension) that provides access to the Authentication object obtained from a Reactor Context, so that it can be used within SpEL expressions of annotated Spring Data queries.
@Query("select m from Message m where m.to.id = ?#{ principal?.id }")
Flux<Message> findInbox();
Context
Spring Data Commons 2.4.0.M2 now contains the required SPI (ReactiveEvaluationContextExtension) to implement reactive SpEL evaluation extensions. (see: DATACMNS-1108)
@christophstrobl, does getExtensionId need to return something different from SecurityEvaluationContextExtension ("security"), and if so, is there a naming convention that's being followed?
@ThomasVitale is this something you are able to add?
Thanks for trying this out @antoinechamot. I can confirm that it works when I modify the MongoDB Spring Data example to include Spring Security and the code you posted. I wonder if your application is using reactive repositories and if the user is authenticated.
Activity
ThomasVitale commentedon May 5, 2021
@jzheaux can I help with this task?
jzheaux commentedon May 6, 2021
Sure, @ThomasVitale, thanks for the offer!
Since
ReactiveEvaluationContextExtension
returns aMono<? extends EvaluationContextExtension>
, let's try and reuseSecurityEvaluationContextExtension
. I'm thinking something like:would work nicely.
@christophstrobl, does
getExtensionId
need to return something different fromSecurityEvaluationContextExtension
("security"
), and if so, is there a naming convention that's being followed?antoinechamot commentedon Jul 17, 2021
It doesn't work I have "Authentication object cannot be null" with
And
@Query("{ $or :[ {'authorId': ?#{principal?.subject}}, {'assigneeId': ?#{principal?.subject}} ] }")
jzheaux commentedon Jul 19, 2021
@ThomasVitale is this something you are able to add?
Thanks for trying this out @antoinechamot. I can confirm that it works when I modify the MongoDB Spring Data example to include Spring Security and the code you posted. I wonder if your application is using reactive repositories and if the user is authenticated.
29 remaining items