Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Navigation [hide] [expand]
ARCHIVED This content is retired and no longer maintained. See the latest version here.

This topic describes using the IRegistrar interface in Episerver Commerce. This interface allows for the ability to have self-registered users who do not need any back-end access functionality. A common use case for this has a user store for management functions of your site, and another user store for customers who buy things from your e-commerce site. The idea behind the interface is to use EPiServer.ServiceLocation.ServiceLocator to register the default instance of the interface. Then in your front-end code you can use the ServiceLocator instance when writing your controllers so you could easily switch to a new IRegistrar user store in the future if need be. 

Note: This configuration requires the EPiServer.Commerce.Security nuget packages as dependency.  

Interface methods

  • String AuthenticationType. Sets the OWIN Authentication Type
  • IPrincipal CreateUser(string userName, string password, string email);. Creates a user in the user store and then 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 password of the user.
  • 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);. Call in the controller when logging in a user; gets the OWIN context and signin with the Authentication property of the OwinContext.

Related topics

Last updated: Oct 12, 2015