Initial commit

This commit is contained in:
2026-02-10 20:02:11 -05:00
parent 35691b2627
commit 8b30f8161c

View File

@@ -5,19 +5,19 @@ declare(strict_types=1);
namespace KTXM\AuthenticationProviderOidc; namespace KTXM\AuthenticationProviderOidc;
use KTXC\Resource\ProviderManager; use KTXC\Resource\ProviderManager;
use DI\Attribute\Inject; use KTXF\Module\ModuleBrowserInterface;
use KTXF\Module\ModuleInstanceAbstract; use KTXF\Module\ModuleInstanceAbstract;
/** /**
* OpenID Connect Identity Provider Module * OpenID Connect Identity Provider Module
* Provides SSO authentication via OIDC protocol * Provides SSO authentication via OIDC protocol
*/ */
class Module extends ModuleInstanceAbstract class Module extends ModuleInstanceAbstract implements ModuleBrowserInterface
{ {
public function __construct( public function __construct(
private readonly ProviderManager $providerManager, private readonly ProviderManager $providerManager,
#[Inject('rootDir')] private readonly string $rootDir,
) {} ) {}
public function handle(): string public function handle(): string
{ {
return 'authentication_provider_oidc'; return 'authentication_provider_oidc';
@@ -40,50 +40,7 @@ class Module extends ModuleInstanceAbstract
public function version(): string public function version(): string
{ {
return '1.0.0'; return '0.0.1';
}
public function boot(): void
{
// Register the provider with the provider manager
$this->providerManager->register('authentication', 'oidc', Provider::class);
}
public function install(): void
{
// Create cache directory for OIDC state
$cacheDir = $this->rootDir . '/var/cache/oidc_state';
if (!is_dir($cacheDir)) {
mkdir($cacheDir, 0755, true);
}
}
public function uninstall(): void
{
// Optionally clean up cache
}
public function enable(): void
{
// Provider is registered on boot
}
public function disable(): void
{
// Nothing to do - provider not registered when module is disabled
}
public function bootUi(): array
{
return [
'handle' => $this->handle(),
'namespace' => 'AuthenticationProviderOidc',
'version' => $this->version(),
'label' => $this->label(),
'author' => $this->author(),
'description' => $this->description(),
'boot' => 'static/module.mjs',
];
} }
public function permissions(): array public function permissions(): array
@@ -96,4 +53,22 @@ class Module extends ModuleInstanceAbstract
], ],
]; ];
} }
public function boot(): void
{
$this->providerManager->register('authentication', 'oidc', Provider::class);
}
public function registerBI(): array
{
return [
'handle' => $this->handle(),
'namespace' => 'AuthenticationProviderOidc',
'version' => $this->version(),
'label' => $this->label(),
'author' => $this->author(),
'description' => $this->description(),
'boot' => 'static/module.mjs',
];
}
} }