3

I am trying to add a IdentityProvider in Sitecore 9.3 as shown below:

<federatedAuthentication>   
  <identityProviders hint="list:AddIdentityProvider">
    <identityProvider id="sc9devsujana.azureAD" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
      <param desc="name">$(id)</param>
      <param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
      <caption>Sign-in with Azure Active Directory</caption>
      <domain>sitecore</domain>
      <icon>/sitecore/shell/themes/standard/Images/24x24/msazure.png</icon>
      </identityProvider>
  </identityProviders>
  <!-- Property initializer assigns claim values to sitecore user properties -->
  <propertyInitializer type="Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication">
    <maps hint="list">
      <map name="email claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <!--claim name-->
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" />
          <!--property name-->
          <target name="Email" />
        </data>
      </map>
      <map name="Name claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication" resolve="true">
        <data hint="raw:AddData">
          <!--claim name-->
          <source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
          <!--property name-->
          <target name="Name" />
        </data>
      </map>
    </maps>
  </propertyInitializer>
  <identityProvidersPerSites>
    <mapEntry name="all" type="Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication" resolve="true" >
      <sites hint="list">
        <site>shell</site>
        <site>login</site>
        <site>admin</site>
        <site>service</site>
        <site>modules_shell</site>
        <site>modules_website</site>
        <site>website</site>
        <site>scheduler</site>
        <site>system</site>
        <site>publisher</site>
      </sites>
      <!-- Registered identity providers for above providers -->
      <identityProviders hint="list:AddIdentityProvider">
        <identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='sc9devsujana.azureAD']" />
      </identityProviders>
       <!-- ExternalUserBuilder is what creates a user with customusername in Sitecore and assigns roles based on claim transformation configured above -->
      <externalUserBuilder type="Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication" resolve="true" >
        <param desc="isPersistentUser">true</param>
      </externalUserBuilder>
    </mapEntry>
  </identityProvidersPerSites>
</federatedAuthentication>

On loading, it gives an error enter image description here Any help on how to resolve this much appreciated.

1

Sitecore.Owin.Authentication.Configuration.IdentityProvider is an abstract class. You either need to implement your own provider that inherits from that abstract class or use the default implementation provided by Sitecore: Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider

Relevant section from the documentation:

Enter values for the id and type attributes. The type must implement the abstract class Sitecore.Owin.Authentication.Configuration.IdentityProvider. Sitecore has a default implementation –Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider.

8
  • I tried with defaultIdentityProvider and it returns the following error Server Error in '/' Application. Identity provider "" was not found in configuration.
    – Sujana
    May 9 '20 at 10:28
  • 1
    I tried the configuration you've shared in the question and I did get one error after changing the IdentityProvider to DefaultIdentityProvider but that seemed to be related to the resolve="true" attribute you've added to the provider declaration. Once I removed that I didn't see any errors May 9 '20 at 10:55
  • That's interesting, is that Sitecore 9.3? This code works in 9.0.2, but mine gives error in 9.3
    – Sujana
    May 9 '20 at 11:59
  • the environment I tested in was 9.2. Maybe something has changed in 9.3? May 9 '20 at 12:07
  • That's right, I am looking for that change, not able to figure out the exact problem. Thanks for your time Christian
    – Sujana
    May 9 '20 at 14:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.