question

SureshBabu-3473 avatar image
0 Votes"
SureshBabu-3473 asked JamesHamil-MSFT commented

RBAC in web app registered under Azure B2C Tenant

I have a web app and web api (both in .net core) registered under Azure B2C Tenant. I have configured user flow for authenticating the users of web app using gmail as the identity provider. I have created app roles in the manifest of web app and assigned to users of this app. How can I get these app roles assigned to users once they log into the web app so that I can include it in the access token for further authorization?

azure-ad-b2c
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SureshBabu-3473 , thanks for the question. To understand correctly, right now if a new user signs up they don't have a role? And you want to automatically assign a role to users on sign up? Have you reviewed this document? Please let me know what questions or clarifications you have and I can help you further.

Best,
James


0 Votes 0 ·

Thanks @JamesHamil-MSFT, for your quick response.

Once a user signs up, I assign him role manually. But the issue is once the same user logs in to the web application which is registered under Azure AD B2C tenant, how do I retrieve the role assigned to him for including in the JWT token to be used for further authorization? The token generated by Azure AD B2C after successful log in doesn't include the role assigned to him. How do I retrieve this role for including in the JWT token?
I just went through youtube video showing how to add role to tokens in Azure AD B2C. Please see the below link

https://www.youtube.com/watch?v=C9qN6QqnxQ8&ab_channel=SSWTV%7CVideosfordevelopers%2Cbydevelopers

Is it the only and recommended way of doing this? Please advise.

0 Votes 0 ·

Hi @SureshBabu-3473 , sorry for the delay in response. have you looked into configuring tokens? You can edit what is returned with custom policies.


0 Votes 0 ·

0 Answers