HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In


The IRegistrar 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.