Initial Version

This commit is contained in:
root
2025-12-21 10:00:27 -05:00
commit 52ff8a8314
12 changed files with 1118 additions and 0 deletions

88
lib/Module.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
namespace KTXM\AuthenticationProviderOidc;
use KTXC\Resource\ProviderManager;
use DI\Attribute\Inject;
use KTXF\Module\ModuleInstanceAbstract;
/**
* OpenID Connect Identity Provider Module
* Provides SSO authentication via OIDC protocol
*/
class Module extends ModuleInstanceAbstract
{
public function __construct(
private readonly ProviderManager $providerManager,
#[Inject('rootDir')] private readonly string $rootDir,
) {}
public function handle(): string
{
return 'authentication_provider_oidc';
}
public function label(): string
{
return 'OpenID Connect Authentication Provider';
}
public function author(): string
{
return 'Ktrix';
}
public function description(): string
{
return 'OpenID Connect (OIDC) authentication provider - enables SSO authentication with Google, Azure AD, Okta, Keycloak, and other OIDC-compliant identity providers';
}
public function version(): string
{
return '1.0.0';
}
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',
];
}
}