composer install spryker-ufirst/second-factor-auth
Once the module is installed, add the SecondFactorAuthorizationEventDispatcherPlugin
to the
EventDispatcherDependencyProvider
after the AuthorizationEventDispatcherPlugin
:
class EventDispatcherDependencyProvider extends SprykerEventDispatcherDependencyProvider
{
/**
* @return \Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface[]
*/
protected function getEventDispatcherPlugins(): array
{
return [
# ...other plugins
new AuthorizationEventDispatcherPlugin(),
new SecondFactorAuthorizationEventDispatcherPlugin(),
# ...other plugins
];
}
}
You can enforce second factor authentication for all admin users per environment. Add the following line to your
config_default.php
:
use Pyz\Shared\SecondFactorAuth\SecondFactorAuthConstants;
$config[SecondFactorAuthConstants::SECOND_FACTOR_AUTH_REQUIRED] = true;
In order to see the 2FA status (enabled/disabled) on each user in the administration GUI, add the two table expander
plugins to the UserDependencyProvider
in your project space:
<?php
namespace Pyz\Zed\User;
use Spryker\Zed\User\UserDependencyProvider as SprykerUserDependencyProvider;
use SprykerUFirst\Zed\SecondFactorAuth\Communication\Plugin\Table\SecondFactorAuthUserTableConfigExpanderPlugin;
use SprykerUFirst\Zed\SecondFactorAuth\Communication\Plugin\Table\SecondFactorAuthUserTableDataExpanderPlugin;
class UserDependencyProvider extends SprykerUserDependencyProvider
{
/**
* @return \Spryker\Zed\UserExtension\Dependency\Plugin\UserTableDataExpanderPluginInterface[]
*/
protected function getUserTableDataExpanderPlugins(): array
{
return [
new SecondFactorAuthUserTableDataExpanderPlugin(),
];
}
/**
* @return \Spryker\Zed\UserExtension\Dependency\Plugin\UserTableConfigExpanderPluginInterface[]
*/
protected function getUserTableConfigExpanderPlugins(): array
{
return [
new SecondFactorAuthUserTableConfigExpanderPlugin(),
];
}
}