Try our conversational search powered by Generative AI!

Applies to versions: 10-13
Other versions:
ARCHIVED This content is retired and no longer maintained. See the version selector for other versions of this topic.

IRegistrar interface [Legacy]

Recommended reading 

This topic describes using the IRegistrar interface in Episerver Commerce. This interface supports self-registered users who do not need back-end access functionality. A common use case for this is a user store for management functions of your site, and another user store for customers who buy goods from your e-commerce site.

How it works

The interface uses EPiServer.ServiceLocation.ServiceLocator to register the default instance of the interface. Then, in your front-end code, use the ServiceLocator instance when writing your controllers, so you can easily switch to a new IRegistrar user store in the future if needed. 

Note: This configuration requires the EPiServer.Commerce.Security NuGet package as dependency.

Interface methods

  • String AuthenticationType. Sets OWIN Authentication Type.
  • IPrincipal CreateUser(string userName, string password, string email);. Creates a user in the user store and returns a ClaimsPrincipal. The principal should contain the following claims for roles Everyone and Registered.
  • void DeleteUser(string userName);. Deletes the user.
  • bool ChangePassword(string userName, string oldPassword, string newPassword);. Changes the user's password.
  • ClaimsIdentity CreateIdentity(string userName);. Creates the ClaimsIdentity with the proper claims provided by the user store.
  • bool ValidateUser(string userName, string password);. Validates the userName and password.
  • void SignIn(AuthenticationProperties properties, params ClaimsIdentity[] identities);. Calls in the controller when logging in a user; gets the OWIN context and signin with the Authentication property of the OwinContext.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Mar 31, 2021

Recommended reading