UserContextInterface
Magento\Authorization\Model\UserContextInterface
What it does
UserContextInterface provides a contract for identifying the current user making a request in Magento 2.
Developers use this interface to determine who is accessing the system (admin, customer, guest, or integration) and retrieve their user ID, which is essential for permission checks, logging, and API authentication.
It's commonly injected into classes that need to perform authorization or track user-specific actions.
Public Methods
- getUserId()
- getUserType()