I have a scenario where the CRM security model is a segregated by business units. Each BU has there own subset of contacts and as a result the database could contain contact records with the same email
address. The issue arises when trying to authenticate these users on a Power Pages site, as each of the programmes these business units serve share a single site, with web roles determining which areas of the site the users can access.
What I would like to achieve is the ability to intercept the response from the external authentication provider and use the role in the response from the EAP to identify which of the duplicate contacts should be a registered with their specific web role.
I’m struggling to figure out how to do this or even identify if this is possible. The default behaviour is for the most recently created contact record with the matching email address to be registered, which almost always results in this being the incorrect contact to register for that service.
One idea was to create a custom Azure B2C app and connect the external identity provider through this app, then see if I can do anything in this flow with regards to identifying the correct contact before the response is sent back to Power Pages. I haven’t looked into this method in detail, so I was wondering if this would be a potential solution or if the is another solution out there which would meet my requirement?