Log in
Model

CompositeUserContext

Magento\Authorization\Model\CompositeUserContext

What it does

This class identifies the current user in Magento 2 by checking multiple user context providers (like customer session, admin session, integration tokens) in priority order.

It returns the user ID and type from the first provider that successfully identifies a user, making it useful for determining who is making a request across different authentication methods.

Public Methods

  • getUserId()
  • getUserType()
  • _resetState()