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:
- A store GET request to be connected to branch ID token claims.
- 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?
- Maintain endpoint: API / Branches: Branch ID / accounts /: Account ID and perform necessary security check
- 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: - 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.
- In addition to this you can easily apply caching, and logging because the full url is descriptive enough
- 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:
- Information redundancy: The branch ID is on the URL and is encrypted on the token.
- A little more effort to implement
Comments
Post a Comment