rest api multi-tenant security -


I have a question in a multi-tenant about empowering apis and security environment:

imagine an endpoint: API / branches: branch ID / account / account ID

authentication through Bearer Tokens (oauth2) goes. Each token contains a group of claims related to the user coming in. A branch ID is included in the token, and each user is related to a branch.

Security restrictions are as follows:

  1. A store GET request to be connected to branch ID token claims.
  2. The account ID should be a valid account within the branch identified by the branch ID.

    The question is: which of the following solutions is correct?

    1. Maintain endpoint: API / Branches: Branch ID / accounts /: Account ID and perform necessary security check
    2. Change the end point to: api / accounts / Get account ID, branch ID from token, and then check remaining security.

      The application being a multi-tenant means that each branch is a tenant, and each user can access only one branch information. Thank you!

      I need to make a decision faster, so I'm of Solution 1 If someone has an argument in favor of one or the other, please join the conversation.

      Argument in the side:

      1. I fully agree with the answer: using the full URL should be determined more efficiently. Distribute the load according to which data store, and accordingly divide the load.
      2. In addition to this you can easily apply caching, and logging because the full url is descriptive enough
      3. Security and the independence of the API today I am using OAuth2 , But maybe tomorrow, I can send the request signature, and because the URL has a request to complete all the requests that it will work. Argument against:
        1. Information redundancy: The branch ID is on the URL and is encrypted on the token.
        2. A little more effort to implement

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -