Note that there are some explanatory texts on larger screens.

plurals
  1. POBest practices for entitlement using spring security and/or shiro
    primarykey
    data
    text
    <p>I'm interested in opinions on the best way to handle the concept of "entitlement" using either Spring Security or Shiro.</p> <p>For example, imagine, say, a JAX-RS endpoint that has a signature like this:</p> <pre><code>AccountDetails getAccountDetails(String accountId); </code></pre> <p>Using Spring Security, I might annotate an implementation like:</p> <pre><code>@Secured(AUTHORIZED_USER) public AccountDetails getAccountDetails(String accountId) { ... } </code></pre> <p>or using Shiro,</p> <pre><code>@RequiresAuthentication public AccountDetails getAccountDetails(String accountId) { ... } </code></pre> <p>What I am looking for, however, is some recommendations on "best practices" for how to ensure that the user has permission to access the particular account id (which I think is called "entitlement management").</p> <p>I could imagine a couple of different approaches:</p> <pre><code>@Secured(AUTHORIZED_USER) @AccountEntitled public AccountDetails getAccountDetails(@Account String accountId) { ... } </code></pre> <p>(which strikes me as not completely straightforward using Spring Security, but I'd love to be wrong).</p> <p>Or, I could imagine introducing an <code>AccountId</code> domain object, and a factory which will only succeed in turning a <code>String</code> into an <code>AccountId</code> if the principle held by the current security context allows that users to see that account. But that starts to get a bit messy.</p> <p>On the whole, I don't want to invent new concepts here; this seems like bread &amp; butter stuff, but I've not had much luck finding credible recommendations around best practices here.</p> <p>Thanks for any suggestions.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload