How can i retrieve additional claims from AzureB2C...
# help-with-umbraco
j
I'm trying to retrieve all claims of a backoffice user from AzureB2C based on https://docs.umbraco.com/umbraco-cms/tutorials/add-google-authentication. Only users that are part of the group "admin" are allowed to autolink. When the authentication is succesfull only 5 claims are received like name and email. No "group" claims in this list. Does anyone have an idea or tip?
b
I've worked with custom azure b2c policies before and by default an user flow does not return the groups that an user is part of in the claims. Are you using a custom policy or an user flow?
j
No I use the same as the tutorial, but then for AzureB2C. No custom policies or user flows.
b
I might not have understood the question then. You're trying to implement Google authentication (as per tutorial link) but are also using B2C (the only option for using B2C is either via custom policy or user flow). Can you elaborate further on the question?
j
I added a external login provider for users based on this link: https://docs.umbraco.com/umbraco-cms/tutorials/add-google-authentication. Since I am using AzureB2C is edited the "AddGoogleAuthentication" method using the ConfigureAuthenticationMethod from: https://docs.umbraco.com/umbraco-cms/tutorials/add-azure-active-directory-authentication. Using this a Microsoft button is added to the login screen for the backoffice I can use to login with SSO. When I debug and put a breakpoint in the OnExternalLogin method from the UserExternalLoginProviderOptions I can see the received loginInfo. The Principal field contains Claims. It would be ideal if I can receive de "group" claims in this method. So I'm only using the tutorials as an extention on a newly created Umbraco 10.7.0 project.
b
You have added a client id and a client secret, this corresponts with an azure AD b2c that you have in your Azure environment. Can you tell me how you've configured that? By default azure B2C does not return user groups
j
The permissions "Group.Read.All" and "GroupMember.Read.All" are enabled on the client in the Azure environment
b
That's good, but the only 2 ways that I know of in which you can customize which claims a B2C tenant returns is by using an IEF policy (custom made) or by setting an user flow and using the correct tenant Id, client Id and also specifying the correct flow in the code and I'm not sure if the Umbraco login works with that. https://learn.microsoft.com/en-us/azure/active-directory-b2c/user-flow-custom-attributes?pivots=b2c-user-flow
4 Views