Files
2026-08-31 22:55:11 -04:00

85 lines
2.6 KiB
PHP

<?php
declare(strict_types=1);
namespace KTXM\AuthenticationProviderPassword;
use KTXC\Resource\ProviderManager;
use KTXF\Module\Configuration\BrowserModuleContextInterface;
use KTXF\Module\Configuration\ConsoleModuleContextInterface;
use KTXF\Module\Configuration\ModuleContextInterface;
use KTXF\Module\ModuleInstanceAbstract;
use KTXM\AuthenticationProviderPassword\Console\UserPasswordCommand;
/**
* Default Identity Provider Module
* Provides local database authentication
*/
class Module extends ModuleInstanceAbstract
{
public function __construct(
private readonly ProviderManager $providerManager,
) {}
public function handle(): string
{
return 'authentication_provider_password';
}
public function label(): string
{
return 'Password Authentication Provider';
}
public function author(): string
{
return 'Ktrix';
}
public function description(): string
{
return 'Ktrix Password Authentication Provider - authenticates users against credentials stored in the database';
}
public function version(): string
{
return '0.0.1';
}
public function permissions(): array
{
return [
'authentication_provider_password' => [
'label' => 'Access Password Authentication Provider',
'description' => 'View and access the password authentication provider module',
'group' => 'Authentication Providers'
],
'authentication_provider_password.admin.view' => [
'label' => 'View Password Status',
'description' => 'View whether another user has a password credential configured',
'group' => 'Authentication Providers'
],
'authentication_provider_password.admin.manage' => [
'label' => 'Manage User Passwords',
'description' => 'Set, reset, or remove password credentials for other users',
'group' => 'Authentication Providers'
],
];
}
public function boot(): void
{
$this->providerManager->register('authentication', 'password', Provider::class);
}
public function configure(ModuleContextInterface $context): void
{
if ($context instanceof BrowserModuleContextInterface) {
$context->registerModule($this, 'AuthenticationProviderPassword', 'static/module.mjs');
}
if ($context instanceof ConsoleModuleContextInterface) {
$context->registerCommand(UserPasswordCommand::class);
}
}
}