refactor(module): register integrations through runtime contexts

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-31 22:40:52 -04:00
parent 9fea6504c6
commit b2fc6f7d36
+10 -19
View File
@@ -5,8 +5,9 @@ declare(strict_types=1);
namespace KTXM\AuthenticationProviderPassword; namespace KTXM\AuthenticationProviderPassword;
use KTXC\Resource\ProviderManager; use KTXC\Resource\ProviderManager;
use KTXF\Module\ModuleBrowserInterface; use KTXF\Module\Configuration\BrowserModuleContextInterface;
use KTXF\Module\ModuleConsoleInterface; use KTXF\Module\Configuration\ConsoleModuleContextInterface;
use KTXF\Module\Configuration\ModuleContextInterface;
use KTXF\Module\ModuleInstanceAbstract; use KTXF\Module\ModuleInstanceAbstract;
use KTXM\AuthenticationProviderPassword\Console\UserPasswordCommand; use KTXM\AuthenticationProviderPassword\Console\UserPasswordCommand;
@@ -14,7 +15,7 @@ use KTXM\AuthenticationProviderPassword\Console\UserPasswordCommand;
* Default Identity Provider Module * Default Identity Provider Module
* Provides local database authentication * Provides local database authentication
*/ */
class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, ModuleBrowserInterface class Module extends ModuleInstanceAbstract
{ {
public function __construct( public function __construct(
private readonly ProviderManager $providerManager, private readonly ProviderManager $providerManager,
@@ -71,23 +72,13 @@ class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, M
$this->providerManager->register('authentication', 'password', Provider::class); $this->providerManager->register('authentication', 'password', Provider::class);
} }
public function registerCI(): array public function configure(ModuleContextInterface $context): void
{ {
return [ if ($context instanceof BrowserModuleContextInterface) {
UserPasswordCommand::class, $context->registerModule($this, 'AuthenticationProviderPassword', 'static/module.mjs');
]; }
if ($context instanceof ConsoleModuleContextInterface) {
$context->registerCommand(UserPasswordCommand::class);
} }
public function registerBI(): array
{
return [
'handle' => $this->handle(),
'namespace' => 'AuthenticationProviderPassword',
'version' => $this->version(),
'label' => $this->label(),
'author' => $this->author(),
'description' => $this->description(),
'boot' => 'static/module.mjs',
];
} }
} }