Reputation: 452
I currently have an Angular SPA App that uses Azure B2c to authorise users, and use the token to pass to microservices to get/set all functionality.
I now want to build an API that clients can use to access the microservices themselves (either directly or through Azure API Management).
I cannot find any good documentation around this - but ideally I would want the users to be able to create "applications" in our App that would give them a API Key and Secret, and they could then use those to exchange for a JWT token that they can pass to the microservices - Azure B2C generated ideally so that it can just use the same authentication we are doing now. The API to convert the Key/Secret into the token would need to be non-interactive.
Azure AD B2C now supports ROPC but that doesn't seem suited, as that would just use the users username and password, which we don't want (as I want users to be able to revoke access). https://learn.microsoft.com/en-us/azure/active-directory-b2c/configure-ropc?tabs=applications
I could build this all external to Azure B2c - have own Identity provider that generates tokens for API, and on all microservices change pipeline to have two auth validations - one for Azure B2c Tokens, and one for own API identity validation, but was hoping there is a more streamlined approach.
Any suggestions?
Upvotes: 1
Views: 915
Reputation: 11315
In this scenario you would architect as follows:
If you use APIM or something similar, they can be configured to trust multiple token issuers.
In summary, the user authentication is protected by B2C User Flows/Policies, and the B2C token issuer. And the API based access is protected by the AAD endpoint of your B2C tenant. The microservice, since shared between both types of authentication mechanisms, needs to trust 2 token issuers.
Upvotes: 2