This content is archived. See latest version here

Introduction

This section provides information on how to use 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 would to have 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 the 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 IRgistrar user store in the future if need be. 

This configuration requires the following nuget packages as dependency:

  • EPiServer.Commerce.Security
       

Interface methods

  • String AuthenticationType
    This property is used to set the OWIN Authentication Type
  • IPrincipal CreateUser(string userName, string password, string email);
    This method will create a user in the user store and then return a ClaimsPrincipal. The principal should contain the following claims for roles Everyone and Registered
  • void DeleteUser(string userName);
    This method will delete the user
  • bool ChangePassword(string userName, string oldPassword, string newPassword);
    This method will change the password of the user
  • ClaimsIdentity CreateIdentity(string userName);
    This method will create the ClaimsIdentity with the proper claims provided by the user store
  • bool ValidateUser(string userName, string password);
    This method will validate the userName and password
  • void SignIn(AuthenticationProperties properties, params ClaimsIdentity[] identities);
    This method should be called in the controller when logging in a user. The method should get the owin context and signin with the Authentication property of the OwinContext.

See also

Last updated: Oct 16, 2014

Feedback?