Bertrand Paul
Bertrand Paul

Reputation: 97

Dependency injection of System.Web.Security.ActiveDirectoryMembershipProvider in ASP.NET CORE 1.0

I'm adding support for extranet users to my corporate application written in ASP.NET core and using the following library: EnterpriseLibrary.Security.AzMan 5.0. It is important to note that this is part of migrating an existing ASP.NET 2.0 web form application where this athentication/Authorisation was implemented.

The xml configuration used with web form application is as follow:

<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
  <providers>
    <add name="AspNetActiveDirectoryMembershipProvider"
      type="System.Web.Security.ActiveDirectoryMembershipProvider"
      connectionStringName="DirectoryConnection" connectionProtection="Secure"
      enableSearchMethods="true" requiresUniqueEmail="true"
      attributeMapUsername="sAMAccountName" description="Default AD connection"
      clientSearchTimeout="30" serverSearchTimeout="30" />
  </providers>
</membership>

With ASP.NET Core i need to add this service using dependancy injection. I need to convert the above to json which is the configuration format for ASP.NET CORE.

I now added the following to appSettings.json:

"AzMan": {
    "defaultProvider": "AspNetActiveDirectoryMembershipProvide",
    "providers": {
      "name": "AspNetActiveDirectoryMembershipProvider",
      "type": "System.Web.Security.ActiveDirectoryMembershipProvider",
      "connectionStringName": "DirectoryConnection",
      "connectionProtection": "Secure",
      "enableSearchMethods": "true",
      "requiresUniqueEmail": "true",
      "attributeMapUsername": "sAMAccountName",
      "description": "Default AD connection",
      "clientSearchTimeout": "30",
      "serverSearchTimeout": "30"

}

Can someone suggest the steps to follow for adding this service via the startup class. ?

Many thanks in advance Bertrand

Upvotes: 0

Views: 427

Answers (0)

Related Questions