2

Sitecore Version: 9.1.1

I am trying to integrate SXA with Fed Auth and Azure B2C.

I have followed the instructions on this question How can I get SXA login working with my Federated Authentication via IdentityServer? and setup my provider.

In my configuration I have the default IndentityProvider and my custom IdentityProvider:

<identityProviders hint="list:AddIdentityProvider">
    <identityProvider id="SitecoreIdentityServer" type="Sitecore.Owin.Authentication.IdentityServer.IdentityServerProvider, Sitecore.Owin.Authentication.IdentityServer" resolve="true"/>
            <caption>Go to login</caption>
            <domain>sitecore</domain>
            <enabled>true</enabled>
            ....
    </identityProvider>

    <identityProvider id="SitecoreIdentityServer/IdS4-AzureB2C" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication" />
            <param desc="name">$(id)</param>
            <param type="Sitecore.Abstractions.BaseDomainManager" desc="domainManager" resolve="true"/>
            <caption>Log in with Azure B2C</caption>
            ....
    </identityProvider>

Then in my identityProvidersPerSites I have configure the SXA site to use the Azure-B2C provider:


    <mapEntry name="sxa site" type="Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication" patch:source="Feature.Accounts.config">
        <sites hint="list">
            <site>sxa</site>
        </sites>
        <identityProviders hint="list:AddIdentityProvider">
            <identityProvider id="SitecoreIdentityServer" ref="federatedAuthentication/identityProviders/identityProvider[@id='SitecoreIdentityServer/IdS4-AzureB2C']"/>
        </identityProviders>
        <externalUserBuilder type="MyProject.ExternalUserBuilder, MyProject"">
            <IsPersistentUser>false</IsPersistentUser>
        </externalUserBuilder>
    </mapEntry>
    <mapEntry name="all sites" type="Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication" />
        <sites hint="list">
            <site>regexp:.*</site>
        </sites>
        <identityProviders hint="list:AddIdentityProvider"/>
        <externalUserBuilder type="MyProject.ExternalUserBuilder, MyProject">
            <IsPersistentUser>true</IsPersistentUser>
        </externalUserBuilder>
    </mapEntry>

Finally in SXA I have add the following property to my site:

loginPage = /identity/login/admin/SitecoreIdentityServer/IdS4-AzureB2C

With this setup i can authenticate the user using Azure B2C. My problem is that when the user comes back to Sitecore from Azure B2C the identity provider that is being used is 'SitecoreIdentityServer' instead of 'SitecoreIdentityServer/IdS4-AzureB2C'. This means that any transforms set in on 'SitecoreIdentityServer/IdS4-AzureB2C' provider aren't running.

I have debugged the code to determine that it is selecting the wrong identity provider.

Does anyone know why, when I return from Azure B2C, it selects the wrong ID provider?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.