Log in
Model

CustomerSessionUserContext

Magento\Customer\Model\Authorization\CustomerSessionUserContext

What it does

This class provides session-based user context for customer authorization in Magento 2.

It retrieves the currently logged-in customer's ID and identifies the user type as a customer, which is used by the authorization system to determine permissions and access rights.

Developers use this when implementing authorization checks or retrieving the current customer context from session data.

Public Methods

  • getUserId()
  • getUserType()