Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>My question is basically should users see different representations for the same URI, or should users be directed to different URIs based on their permissions?</p> <p>For example: User A and User B have different permissions in the system. They log in with different credentials, to the same start URI. A successful response may be one of the following 2:</p> <ol> <li>200 OK, and User A sees something different than user B on the same URI</li> <li>302 (or other redirect) each user to e.g. /endpoint/userA (which they own)</li> </ol> </blockquote> <p>Both ways are RESTful. The representation of a resource can depend on the permissions. The communication is stateless because you send the credentials (username, password) with http auth by every request. Redirection to another representation variant after permission check is a great idea. That way you can completely separate the authorization logic from the resource representation logic, so you can move it even to another server and you can create very well cacheable resource representations. For example by <code>GET /endpoint/userA</code> you can redirect <code>userA</code> to <code>/endpoint/userA?owner=true</code>, because she is the owner of the profile, or you can create a composition of features: <code>/endpoint/userA?feature1=true&amp;feature2=false</code> etc... It is very easy to setup fine grained access control for that. Another way to stay cacheable if you append the user id to every request's queryString, but this solution with redirection is much cleaner. Thank you for that!</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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