Optimizely Customized Commerce has full support for the standard Optimizely membership and role providers, including Multiplex and Active Directory. Customized Commerce uses the [ASP.NET membership provider](🔗) model to provide secure user management for the framework. By using the provider model, you can write a custom provider to store the user information in any system and still have it function within Customized Commerce.
When using custom membership, the first step is to add the custom provider to the application by adding a reference to the library containing the provider. By default, you do not need this because the "custom" provider is already referenced.
Define the membership provider in the application _web.config_ file.
The above code shows the configuration of the CustomerSqlMembershipProvider. If you want to replace the provider, change the type to point to the new provider.
In Customized Commerce, you need a way to associate an authenticated user (as given by the membership provider) with a Contact/Customer. Because a property named ProviderUserKey on the MembershipUser object (as returned by a membership provider) is a unique key that identifies the user, we use that identifier.
Unfortunately, ProviderUserKey is typed as Object, and there is no generic way to convert it to something you can store and use for comparisons. To handle this, Customized Commerce has code to select different conversion methods to/from a string, depending on the type of ProviderUserKey. It currently supports Guids (used by SqlMembershipProvider), **Int32** (common choice for database identifier), **SID** (Windows identity) and **byte\** (binary data). This means that, out-of-the-box, any membership provider that uses any of the four data types for the ProviderUserKey works.
If your membership provider uses any other data type for the ProviderUserKey, implement an interface (IConvertUserKey) and register your class with the **IoC container** in Optimizely Commerce.