Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ad48f9767 | |||
| b2fc6f7d36 | |||
| 9fea6504c6 | |||
| e391ff6915 | |||
| 3556be7c85 |
Generated
+46
-34
@@ -9,20 +9,20 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.13.4",
|
||||
"version": "1.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
|
||||
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
|
||||
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
"php": "^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
@@ -57,15 +57,15 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.14.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
"url": "https://github.com/mnapoli",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-08-01T08:46:24+00:00"
|
||||
"time": "2026-08-11T10:17:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
@@ -332,23 +332,23 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
"version": "6.0.1",
|
||||
"version": "6.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||
"reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5"
|
||||
"reference": "a248d1640ab059b075f53a2ef0f9856e864e06b5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5",
|
||||
"reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a248d1640ab059b075f53a2ef0f9856e864e06b5",
|
||||
"reference": "a248d1640ab059b075f53a2ef0f9856e864e06b5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^12.0"
|
||||
"phpunit/phpunit": "^12.5.33"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -381,7 +381,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
||||
"security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.1"
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -401,7 +401,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-02-02T14:04:18+00:00"
|
||||
"time": "2026-08-25T14:40:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-invoker",
|
||||
@@ -589,16 +589,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "12.5.31",
|
||||
"version": "12.5.35",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d"
|
||||
"reference": "345ac22e42cb14cdc7aa8428655d8bb8c82a4aab"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/345ac22e42cb14cdc7aa8428655d8bb8c82a4aab",
|
||||
"reference": "345ac22e42cb14cdc7aa8428655d8bb8c82a4aab",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -608,18 +608,18 @@
|
||||
"ext-libxml": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"myclabs/deep-copy": "^1.13.4",
|
||||
"myclabs/deep-copy": "^1.14.0",
|
||||
"phar-io/manifest": "^2.0.4",
|
||||
"phar-io/version": "^3.2.1",
|
||||
"php": ">=8.3",
|
||||
"phpunit/php-code-coverage": "^12.5.7",
|
||||
"phpunit/php-file-iterator": "^6.0.1",
|
||||
"phpunit/php-file-iterator": "^6.0.2",
|
||||
"phpunit/php-invoker": "^6.0.0",
|
||||
"phpunit/php-text-template": "^5.0.0",
|
||||
"phpunit/php-timer": "^8.0.0",
|
||||
"sebastian/cli-parser": "^4.2.1",
|
||||
"sebastian/comparator": "^7.1.8",
|
||||
"sebastian/diff": "^7.0.0",
|
||||
"sebastian/diff": "^7.0.1",
|
||||
"sebastian/environment": "^8.1.2",
|
||||
"sebastian/exporter": "^7.0.3",
|
||||
"sebastian/global-state": "^8.0.3",
|
||||
@@ -667,7 +667,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.31"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.35"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -675,7 +675,7 @@
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-06T14:54:16+00:00"
|
||||
"time": "2026-09-09T04:48:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
@@ -898,24 +898,24 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "7.0.0",
|
||||
"version": "7.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "7ab1ea946c012266ca32390913653d844ecd085f"
|
||||
"reference": "cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f",
|
||||
"reference": "7ab1ea946c012266ca32390913653d844ecd085f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6",
|
||||
"reference": "cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^12.0",
|
||||
"symfony/process": "^7.2"
|
||||
"phpunit/phpunit": "^12.5.33",
|
||||
"symfony/process": "^7.4.17"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -953,15 +953,27 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"security": "https://github.com/sebastianbergmann/diff/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/7.0.0"
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/7.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://liberapay.com/sebastianbergmann",
|
||||
"type": "liberapay"
|
||||
},
|
||||
{
|
||||
"url": "https://thanks.dev/u/gh/sebastianbergmann",
|
||||
"type": "thanks_dev"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/sebastian/diff",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-07T04:55:46+00:00"
|
||||
"time": "2026-08-25T15:35:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -1698,5 +1710,5 @@
|
||||
"php": ">=8.3"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.9.0"
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace KTXM\AuthenticationProviderPassword\Controllers;
|
||||
|
||||
use KTXC\Http\Response\JsonResponse;
|
||||
use KTXC\Service\UserAccountsService;
|
||||
use KTXC\SessionIdentity;
|
||||
use KTXC\SessionTenant;
|
||||
use KTXC\Context\IdentityContextInterface;
|
||||
use KTXC\Context\TenantContextInterface;
|
||||
use KTXF\Controller\ControllerAbstract;
|
||||
use KTXF\Routing\Attributes\AuthenticatedRoute;
|
||||
use KTXF\Security\Crypto;
|
||||
@@ -15,8 +15,8 @@ use KTXM\AuthenticationProviderPassword\Stores\CredentialStore;
|
||||
class PasswordController extends ControllerAbstract
|
||||
{
|
||||
public function __construct(
|
||||
private readonly SessionIdentity $sessionIdentity,
|
||||
private readonly SessionTenant $sessionTenant,
|
||||
private readonly IdentityContextInterface $identityContext,
|
||||
private readonly TenantContextInterface $tenantContext,
|
||||
private readonly CredentialStore $credentialStore,
|
||||
private readonly Provider $provider,
|
||||
private readonly Crypto $crypto,
|
||||
@@ -27,8 +27,8 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/password/update', name: 'password.update', methods: ['POST'])]
|
||||
public function update(string $current_password, string $new_password): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$identifier = $this->sessionIdentity->mailAddress();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
$identifier = $this->identityContext->mailAddress();
|
||||
|
||||
if ($tenantId === null || $identifier === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
@@ -56,7 +56,7 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/status', name: 'password.admin.status', methods: ['POST'], permissions: ['authentication_provider_password.admin.view', 'authentication_provider_password.admin.manage'])]
|
||||
public function getStatus(string $uid): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
@@ -82,7 +82,7 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/reset', name: 'password.admin.reset', methods: ['POST'], permissions: ['authentication_provider_password.admin.manage'])]
|
||||
public function adminReset(string $uid, string $password): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
@@ -113,7 +113,7 @@ class PasswordController extends ControllerAbstract
|
||||
#[AuthenticatedRoute('/remove', name: 'password.admin.remove', methods: ['POST'], permissions: ['authentication_provider_password.admin.manage'])]
|
||||
public function adminRemove(string $uid): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$tenantId = $this->tenantContext->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
|
||||
+11
-20
@@ -5,8 +5,9 @@ declare(strict_types=1);
|
||||
namespace KTXM\AuthenticationProviderPassword;
|
||||
|
||||
use KTXC\Resource\ProviderManager;
|
||||
use KTXF\Module\ModuleBrowserInterface;
|
||||
use KTXF\Module\ModuleConsoleInterface;
|
||||
use KTXF\Module\Configuration\BrowserModuleContextInterface;
|
||||
use KTXF\Module\Configuration\ConsoleModuleContextInterface;
|
||||
use KTXF\Module\Configuration\ModuleContextInterface;
|
||||
use KTXF\Module\ModuleInstanceAbstract;
|
||||
use KTXM\AuthenticationProviderPassword\Console\UserPasswordCommand;
|
||||
|
||||
@@ -14,7 +15,7 @@ use KTXM\AuthenticationProviderPassword\Console\UserPasswordCommand;
|
||||
* Default Identity Provider Module
|
||||
* Provides local database authentication
|
||||
*/
|
||||
class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, ModuleBrowserInterface
|
||||
class Module extends ModuleInstanceAbstract
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ProviderManager $providerManager,
|
||||
@@ -71,23 +72,13 @@ class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, M
|
||||
$this->providerManager->register('authentication', 'password', Provider::class);
|
||||
}
|
||||
|
||||
public function registerCI(): array
|
||||
public function configure(ModuleContextInterface $context): void
|
||||
{
|
||||
return [
|
||||
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',
|
||||
];
|
||||
if ($context instanceof BrowserModuleContextInterface) {
|
||||
$context->registerModule($this, 'AuthenticationProviderPassword', 'static/module.mjs');
|
||||
}
|
||||
if ($context instanceof ConsoleModuleContextInterface) {
|
||||
$context->registerCommand(UserPasswordCommand::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ const saveChanges = async () => {
|
||||
label="Current Password"
|
||||
placeholder="············"
|
||||
variant="outlined"
|
||||
autocomplete="off"
|
||||
autocomplete="new-password"
|
||||
@click:append-inner="isCurrentPasswordVisible = !isCurrentPasswordVisible"
|
||||
/>
|
||||
</VCol>
|
||||
@@ -150,7 +150,7 @@ const saveChanges = async () => {
|
||||
label="New Password"
|
||||
placeholder="············"
|
||||
variant="outlined"
|
||||
autocomplete="suppress"
|
||||
autocomplete="new-password"
|
||||
@click:append-inner="isNewPasswordVisible = !isNewPasswordVisible"
|
||||
/>
|
||||
</VCol>
|
||||
@@ -164,7 +164,7 @@ const saveChanges = async () => {
|
||||
label="Confirm New Password"
|
||||
placeholder="············"
|
||||
variant="outlined"
|
||||
autocomplete="suppress"
|
||||
autocomplete="new-password"
|
||||
:error="confirmPassword.length > 0 && confirmPassword !== newPassword"
|
||||
:error-messages="confirmPassword.length > 0 && confirmPassword !== newPassword ? ['Passwords do not match'] : []"
|
||||
@click:append-inner="isConfirmPasswordVisible = !isConfirmPasswordVisible"
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace KTXT\AuthenticationProviderPassword\Tests\Integration;
|
||||
|
||||
use KTXC\Http\Request\Request;
|
||||
use KTXC\Http\Response\Response;
|
||||
use KTXC\Server;
|
||||
use KTXC\Application;
|
||||
use KTXC\Stores\UserRolesStore;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -19,11 +19,11 @@ use PHPUnit\Framework\TestCase;
|
||||
* through the real HTTP kernel (routing, tenant resolution, auth middleware,
|
||||
* controller), not by calling controllers directly.
|
||||
*
|
||||
* A fresh Server (and DI container) is built for every request() call,
|
||||
* A fresh Application (and DI container) is built for every request() call,
|
||||
* mirroring the one-process-per-request model this app is actually
|
||||
* deployed under. Session identity is a container-lifetime singleton that
|
||||
* AuthenticationMiddleware only ever sets, never clears, so reusing one
|
||||
* Server across requests would leak an authenticated identity from one
|
||||
* Application across requests would leak an authenticated identity from one
|
||||
* "request" into the next — a problem that can't occur in production,
|
||||
* where each request gets its own process, but very much can here.
|
||||
*
|
||||
@@ -37,7 +37,7 @@ abstract class IntegrationTestCase extends TestCase
|
||||
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
if (static::buildServer()->environment() === 'prod') {
|
||||
if (static::buildApplication()->environment() === 'prod') {
|
||||
self::fail('Refusing to run integration tests against a server configured for the "prod" environment.');
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ abstract class IntegrationTestCase extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
protected static function buildServer(): Server
|
||||
protected static function buildApplication(): Application
|
||||
{
|
||||
return new Server(SERVER_ROOT);
|
||||
return Application::create(SERVER_ROOT);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -103,17 +103,16 @@ abstract class IntegrationTestCase extends TestCase
|
||||
*/
|
||||
protected static function createRoleWithPermissions(array $permissions, string $label = 'Test Role'): string
|
||||
{
|
||||
$server = static::buildServer();
|
||||
$application = static::buildApplication();
|
||||
try {
|
||||
$server->kernel()->boot();
|
||||
$store = $server->container()->get(UserRolesStore::class);
|
||||
$application->kernel()->boot();
|
||||
$store = $application->container()->get(UserRolesStore::class);
|
||||
$role = $store->createRole(static::$tenantIdentifier, [
|
||||
'label' => $label,
|
||||
'permissions' => $permissions,
|
||||
]);
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
$application->shutdown();
|
||||
}
|
||||
|
||||
return $role['rid'];
|
||||
@@ -174,15 +173,13 @@ abstract class IntegrationTestCase extends TestCase
|
||||
$uri = 'http://' . static::$tenantDomain . $path;
|
||||
$request = Request::create($uri, $method, [], [], [], $server, $content);
|
||||
|
||||
// Kernel::boot() registers a global error/exception handler per
|
||||
// instance and never removes it (fine under one-process-per-request
|
||||
// in production; here it would otherwise stack a handler per test).
|
||||
// Pop back to whatever was in place before this request.
|
||||
// A fresh application mirrors production while shutdown restores its
|
||||
// process-level error handler after the in-process request.
|
||||
$application = static::buildApplication();
|
||||
try {
|
||||
$response = static::buildServer()->handle($request);
|
||||
$response = $application->runHttpRequest($request);
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
$application->shutdown();
|
||||
}
|
||||
|
||||
$body = $response->getContent();
|
||||
|
||||
Reference in New Issue
Block a user