Backend Auth model
@api
- Since
- 100.0.2
Definition at line 19 of file Auth.php.
◆ __construct()
- Parameters
-
\Magento\Framework\Event\ManagerInterface | $eventManager | |
\Magento\Backend\Helper\Data | $backendData | |
\Magento\Backend\Model\Auth\StorageInterface | $authStorage | |
\Magento\Backend\Model\Auth\Credential\StorageInterface | $credentialStorage | |
\Magento\Framework\App\Config\ScopeConfigInterface | $coreConfig | |
\Magento\Framework\Data\Collection\ModelFactory | $modelFactory | |
Definition at line 63 of file Auth.php.
71 $this->_eventManager = $eventManager;
72 $this->_backendData = $backendData;
73 $this->_authStorage = $authStorage;
74 $this->_credentialStorage = $credentialStorage;
75 $this->_coreConfig = $coreConfig;
76 $this->_modelFactory = $modelFactory;
◆ _initCredentialStorage()
_initCredentialStorage |
( |
| ) |
|
|
protected |
Initialize credential storage from configuration
- Returns
- void
Definition at line 123 of file Auth.php.
125 $this->_credentialStorage = $this->_modelFactory->create(
126 \
Magento\Backend\Model\Auth\Credential\StorageInterface::class
◆ getAuthStorage()
Return auth storage. If auth storage was not defined outside - returns default object of auth storage
- Returns
- \Magento\Backend\Model\Auth\StorageInterface @codeCoverageIgnore
Definition at line 102 of file Auth.php.
◆ getCredentialStorage()
Return credential storage object
- Returns
- null|\Magento\Backend\Model\Auth\Credential\StorageInterface @codeCoverageIgnore
Definition at line 136 of file Auth.php.
◆ getUser()
Return current (successfully authenticated) user, an instance of \Magento\Backend\Model\Auth\Credential\StorageInterface
- Returns
- \Magento\Backend\Model\Auth\Credential\StorageInterface
Definition at line 113 of file Auth.php.
◆ isLoggedIn()
Check if current user is logged in
- Returns
- bool
Definition at line 216 of file Auth.php.
◆ login()
login |
( |
|
$username, |
|
|
|
$password |
|
) |
| |
Perform login process
- Parameters
-
string | $username | |
string | $password | |
- Returns
- void
- Exceptions
-
Definition at line 149 of file Auth.php.
151 if (empty($username) || empty($password)) {
154 'The account sign-in was incorrect or your account is disabled temporarily. ' 155 .
'Please wait and try again later.' 167 $this->_eventManager->dispatch(
168 'backend_auth_user_login_success',
176 'The account sign-in was incorrect or your account is disabled temporarily. ' 177 .
'Please wait and try again later.' 181 }
catch (PluginAuthenticationException $e) {
182 $this->_eventManager->dispatch(
183 'backend_auth_user_login_failed',
184 [
'user_name' => $username,
'exception' => $e]
187 }
catch (\
Magento\Framework\Exception\LocalizedException $e) {
188 $this->_eventManager->dispatch(
189 'backend_auth_user_login_failed',
190 [
'user_name' => $username,
'exception' => $e]
194 $e->getMessage()? :
'The account sign-in was incorrect or your account is disabled temporarily. ' 195 .
'Please wait and try again later.'
static throwException(Phrase $msg=null)
◆ logout()
Perform logout process
- Returns
- void
Definition at line 206 of file Auth.php.
◆ setAuthStorage()
setAuthStorage |
( |
|
$storage | ) |
|
Set auth storage if it is instance of \Magento\Backend\Model\Auth\StorageInterface
- Parameters
-
\Magento\Backend\Model\Auth\StorageInterface | $storage | |
- Returns
- $this
- Exceptions
-
Definition at line 86 of file Auth.php.
88 if (!$storage instanceof \
Magento\Backend\Model\Auth\StorageInterface) {
91 $this->_authStorage = $storage;
static throwException(Phrase $msg=null)
◆ throwException()
static throwException |
( |
Phrase |
$msg = null | ) |
|
|
static |
Throws specific Backend Authentication \Exception
- Parameters
-
\Magento\Framework\Phrase | $msg | |
- Returns
- void
- Exceptions
-
Definition at line 229 of file Auth.php.
232 $msg =
__(
'An authentication error occurred. Verify and try again.');
234 throw new AuthenticationException($msg);
◆ $_authStorage
◆ $_backendData
◆ $_coreConfig
◆ $_credentialStorage
◆ $_eventManager
◆ $_modelFactory
The documentation for this class was generated from the following file:
- vendor/magento/module-backend/Model/Auth.php