2
GETクエリパラメータでこのユーザを指定せずにfindAll()メソッドを使用して、現在のユーザ関連エンティティを返すためにSpring Data RestとSpring Securityを使用できますか?
私の唯一の解決策は、パラメータとして、ユーザーを渡すことですが、多分それは別のオプションは、SpringセキュリティでのSpringデータレスト - 現在のユーザですべてを検索
public interface InvoiceRepository extends CrudRepository<Invoice, Long> {
@RestResource
@PreAuthorize("hasRole('ROLE_ADMIN') or user?.username == authentication.name")
List<Invoice> findAllByUser(@Param("user") User user);
ありがとうございます! – ShaggyBathDuck
@ShaggyBathDuckあなたを助けたupvoted答えを受け入れることを忘れないでください... – Cepr0