Reputation: 121
I'm tasked with building a multi-tenant product platform and I'm having a hard time deciding how I should implement authentication and authorization. Mostly I'm confused about AAD capabilities and best practices. The project is not for a big enterprise but a small scale greenfield project. I'm looking for answers to my questions and feedback on the authentication and authorization architecture.
I have some requirements to fulfill:
R1. No local users, all users belong to an external company and should authenticate using their current IdP (Google, Microsoft account).
R2. Good security practices. (Zero trust and granular access management RBAC)
So my current understanding is that in order to achieve secure communications between my cloud resources above I should utilize Managed Identites (System Assigned), issued from "My Company AAD" in the picture above.
Questions/statements:
scopes: "users/read"
can read user data").References:
Apply the verify explicitly Zero Trust principle to your API implementation
Upvotes: 1
Views: 806
Reputation: 29291
I'll answer this based on standard OAuth design patterns:
A1
AAD B2C is an authorization server (AS), which is the role you need. It belongs to you and protects your data. It can authenticate users in many ways, including external IDPs, eg Google. After external login it is common to create a user record in the AS.
After login you will call APIs with access tokens that contain a subject claim. Do you then need to store business resources against users? Eg products purchased? If so you need a stable subject claim - it is worth thinking more about that.
A2
The AS can federate to an enterprise IDP, when provided. If an enterprise chooses not to provide one, you can give them a default login method managed by the AS, eg passwords. This will store a user record in the AS.
A3
Yes - custom scopes and claims are defined in the AS where you can control them. They are issued to access tokens and you use them in APIs to control access. In your case you may need a tenant_id
claim, so you need to think through how tenants get assigned to users.
A4
Yes - that is a key point of using an AS. Your apps run a code flow to the AS, which receives external tokens, then issues AS tokens to your apps.
A5
An optimal way to manage microservices from the same owner is often to forward access tokens between them. This flows the user identity in an auditable way and enables user based authorization in each API. It should be combined with good use of scopes and claims in APIs, and assigning of scopes to clients. Eg if a client is given scopes orders shipping
, its access token would be rejected if sent to a payments API.
A6
Yes - as above.
Upvotes: 1