私はSpring Securityを使用しています。これは、ユーザーがリソースにアクセスする前に特定の役割を持っていることを確認するのに効果的です。しかし、今私は少し違うものを検証する必要があります:
`/product/edit/{productId}`
What is the best way to verify that the logged in user "owns" productId
? My business mappings handle the relationship (a user
has a list of products
). I need to verify this product belongs to the user and hence, they can edit it.
私はコントローラとインターセプタの両方で productId
とログインしているユーザにアクセスする方法を知っています。私はこの論理がコントローラに全く属しているとは思わない。インターセプタは良く見えますが、Spring Securityがこの状況を「受け入れる」方法を持っているかどうかは疑問でした。