Identity

Overview

Smartstore builds on ASP.NET Core Identity to manage user accounts, roles and authentication. The platform models users with the Customerarrow-up-right entity and groups permissions through CustomerRolearrow-up-right records. Custom implementations of SignInManager, UserStore and PasswordHasher adapt the framework to Smartstore's business rules.

Customers and roles

  • Customer: primary user record storing credentials, profile data and activity flags.

  • CustomerRole: represents membership groups and the permission set assigned to customers.

  • ExternalAuthenticationRecord persists links between a customer and third-party identities.

  • Background tasks like DeleteGuestsTaskarrow-up-right keep the identity store tidy.

Getting the current customer

The current customer can be retrieved through IWorkContextarrow-up-right:

public class MyService
{
    private readonly IWorkContext _workContext;

    public MyService(IWorkContext workContext)
    {
        _workContext = workContext;
    }

    public Customer GetCurrentCustomer()
        => _workContext.CurrentCustomer
}

Authentication

SmartSignInManagerarrow-up-right extends ASP.NET Core's SignInManager to support login by email or username, generate authentication cookies and enforce lockout.

UserManager<Customer> exposes helpers for password reset, email confirmation and role assignment.

External authentication

Modules may register external login providers by implementing IExternalAuthenticationMethodarrow-up-right. Each provider registers its configuration and callback routes in its Startup class. Smartstore ships modules for popular platforms like Facebook and Google, and custom modules can add additional providers in the same way.

Last updated

Was this helpful?