So my company (let's call it CompanyA) have a case where my users/clients can use their company Identity Provider (OpenID) to login to our products (web-based). I provided a REST API (net core) where they can access and modify their own settings for OpenID.
For API access, they will also authenticate using their own company account. This API has a methods where some of them are only allowed to be accessed by internal (CompanyA). For example:
I have 3 methods
- Client/List -> can be accessed by internal and external (but external can only view their own)
- Client/Add -> can be accessed by internal and external
- Client/Remove -> can be accessed by internal
Now, the problem is that since I have no access to their Identity Provider, I can't exactly control what kind of claims are present in the token.
My method has something like [Authorize(Roles = "Admin")] to tell whether a user has access. So, my question is what is the best practice for this kind of case? And I do have a DB where I can check whether logged in user (by email) has access. Is it possible for example after successful login, I will check the token and get the email value from the token and apply Roles accordingly?