Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad5536529d |
Generated
+7
-7
@@ -589,16 +589,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "12.5.31",
|
||||
"version": "12.5.32",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d"
|
||||
"reference": "c02591dd7840ed124a98d7770753329ad28e9f8f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c02591dd7840ed124a98d7770753329ad28e9f8f",
|
||||
"reference": "c02591dd7840ed124a98d7770753329ad28e9f8f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -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.32"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -675,7 +675,7 @@
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-06T14:54:16+00:00"
|
||||
"time": "2026-07-25T06:54:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
@@ -1698,5 +1698,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\Context\IdentityContextInterface;
|
||||
use KTXC\Context\TenantContextInterface;
|
||||
use KTXC\SessionIdentity;
|
||||
use KTXC\SessionTenant;
|
||||
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 IdentityContextInterface $identityContext,
|
||||
private readonly TenantContextInterface $tenantContext,
|
||||
private readonly SessionIdentity $sessionIdentity,
|
||||
private readonly SessionTenant $sessionTenant,
|
||||
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->tenantContext->identifier();
|
||||
$identifier = $this->identityContext->mailAddress();
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
$identifier = $this->sessionIdentity->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->tenantContext->identifier();
|
||||
$tenantId = $this->sessionTenant->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->tenantContext->identifier();
|
||||
$tenantId = $this->sessionTenant->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->tenantContext->identifier();
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
|
||||
if ($tenantId === null) {
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
|
||||
Generated
+50
-47
@@ -15,7 +15,7 @@
|
||||
"@vitejs/plugin-vue": "^6.0.0",
|
||||
"@vitest/coverage-v8": "^4.1.6",
|
||||
"@vue/test-utils": "^2.4.10",
|
||||
"jsdom": "^30.0.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"typescript": "~6.0.0",
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "^4.1.6",
|
||||
@@ -23,38 +23,56 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/css-color": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-6.0.5.tgz",
|
||||
"integrity": "sha512-mbhpPMmnw/kwW19aRNmSUl1QzLbdGo1SCuE49BT98MNwqF6zaHb3o2owssFc/PEO/4t2UjqtCNwocuDtJornzA==",
|
||||
"version": "5.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz",
|
||||
"integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@csstools/css-calc": "^3.2.1",
|
||||
"@csstools/css-color-parser": "^4.1.9",
|
||||
"@asamuzakjp/generational-cache": "^1.0.1",
|
||||
"@csstools/css-calc": "^3.2.0",
|
||||
"@csstools/css-color-parser": "^4.1.0",
|
||||
"@csstools/css-parser-algorithms": "^4.0.0",
|
||||
"@csstools/css-tokenizer": "^4.0.0",
|
||||
"lru-cache": "^11.5.2"
|
||||
"@csstools/css-tokenizer": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.13.0 || >=24.0.0"
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/dom-selector": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-8.3.0.tgz",
|
||||
"integrity": "sha512-UJLfKXBhrc8i1vH2eJXuYQMwlsLKWFw3O+CPqXSuVEiikeAim3UgrfWX0k4tA/X8cRFM8iZ7OaqBokFGbYusdg==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz",
|
||||
"integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/generational-cache": "^1.0.1",
|
||||
"@asamuzakjp/nwsapi": "^2.3.9",
|
||||
"bidi-js": "^1.0.3",
|
||||
"css-tree": "^3.2.1",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"lru-cache": "^11.5.2"
|
||||
"is-potential-custom-element-name": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.13.0 || >=24.0.0"
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/generational-cache": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz",
|
||||
"integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/nwsapi": {
|
||||
"version": "2.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz",
|
||||
"integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.29.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
|
||||
@@ -1569,39 +1587,39 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jsdom": {
|
||||
"version": "30.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.0.0.tgz",
|
||||
"integrity": "sha512-JQHfRGmmKmaZoUAvIgff5jjG/0SzTQlGz8c7t72KzBzo8ZULEjAjnYE0sNwBOUA4QtWwYE2xoYitg8NFsmiYxA==",
|
||||
"version": "29.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz",
|
||||
"integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/css-color": "^6.0.5",
|
||||
"@asamuzakjp/dom-selector": "^8.2.5",
|
||||
"@asamuzakjp/css-color": "^5.1.11",
|
||||
"@asamuzakjp/dom-selector": "^7.1.1",
|
||||
"@bramus/specificity": "^2.4.2",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.1.6",
|
||||
"@exodus/bytes": "^1.15.1",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.1.3",
|
||||
"@exodus/bytes": "^1.15.0",
|
||||
"css-tree": "^3.2.1",
|
||||
"data-urls": "^7.0.0",
|
||||
"decimal.js": "^10.6.0",
|
||||
"html-encoding-sniffer": "^6.0.0",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"lru-cache": "^11.5.2",
|
||||
"lru-cache": "^11.3.5",
|
||||
"parse5": "^8.0.1",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^6.0.2",
|
||||
"undici": "^8.7.0",
|
||||
"tough-cookie": "^6.0.1",
|
||||
"undici": "^7.25.0",
|
||||
"w3c-xmlserializer": "^5.0.0",
|
||||
"webidl-conversions": "^8.0.1",
|
||||
"whatwg-mimetype": "^5.0.0",
|
||||
"whatwg-url": "^17.1.0",
|
||||
"whatwg-url": "^16.0.1",
|
||||
"xml-name-validator": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
||||
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^3.2.3"
|
||||
"canvas": "^3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
@@ -1609,21 +1627,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/whatwg-url": {
|
||||
"version": "17.1.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.0.tgz",
|
||||
"integrity": "sha512-3GeworPmc2ZfEEHP7lEbUfBX/L75wdEsi0rLNhXcXxnoN5jyq0SL5gCy06SGW2cyTIZdTvWIDQNQoza++vKeaw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@exodus/bytes": "^1.15.1",
|
||||
"tr46": "^6.0.0",
|
||||
"webidl-conversions": "^8.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.14.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
|
||||
@@ -2538,13 +2541,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "8.9.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-8.9.0.tgz",
|
||||
"integrity": "sha512-aWZpUj7XoGonMClx4gdDRfgBjqeA+F473aDmROQQbM9n6PRfK/u1q/a0X4wMTgcHfT8H6fpbt98PFuDUwFg2YA==",
|
||||
"version": "7.28.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-7.28.0.tgz",
|
||||
"integrity": "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=22.19.0"
|
||||
"node": ">=20.18.1"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
"vue-tsc": "^3.0.0",
|
||||
"@vitest/coverage-v8": "^4.1.6",
|
||||
"@vue/test-utils": "^2.4.10",
|
||||
"jsdom": "^30.0.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"vitest": "^4.1.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace KTXT\AuthenticationProviderPassword\Tests\Integration;
|
||||
|
||||
use KTXC\Http\Request\Request;
|
||||
use KTXC\Http\Response\Response;
|
||||
use KTXC\Application;
|
||||
use KTXC\Server;
|
||||
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 Application (and DI container) is built for every request() call,
|
||||
* A fresh Server (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
|
||||
* Application across requests would leak an authenticated identity from one
|
||||
* Server 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::buildApplication()->environment() === 'prod') {
|
||||
if (static::buildServer()->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 buildApplication(): Application
|
||||
protected static function buildServer(): Server
|
||||
{
|
||||
return Application::create(SERVER_ROOT);
|
||||
return new Server(SERVER_ROOT);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -103,16 +103,17 @@ abstract class IntegrationTestCase extends TestCase
|
||||
*/
|
||||
protected static function createRoleWithPermissions(array $permissions, string $label = 'Test Role'): string
|
||||
{
|
||||
$application = static::buildApplication();
|
||||
$server = static::buildServer();
|
||||
try {
|
||||
$application->kernel()->boot();
|
||||
$store = $application->container()->get(UserRolesStore::class);
|
||||
$server->kernel()->boot();
|
||||
$store = $server->container()->get(UserRolesStore::class);
|
||||
$role = $store->createRole(static::$tenantIdentifier, [
|
||||
'label' => $label,
|
||||
'permissions' => $permissions,
|
||||
]);
|
||||
} finally {
|
||||
$application->shutdown();
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
}
|
||||
|
||||
return $role['rid'];
|
||||
@@ -173,13 +174,15 @@ abstract class IntegrationTestCase extends TestCase
|
||||
$uri = 'http://' . static::$tenantDomain . $path;
|
||||
$request = Request::create($uri, $method, [], [], [], $server, $content);
|
||||
|
||||
// A fresh application mirrors production while shutdown restores its
|
||||
// process-level error handler after the in-process request.
|
||||
$application = static::buildApplication();
|
||||
// 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.
|
||||
try {
|
||||
$response = $application->handleHttp($request);
|
||||
$response = static::buildServer()->handle($request);
|
||||
} finally {
|
||||
$application->shutdown();
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
}
|
||||
|
||||
$body = $response->getContent();
|
||||
|
||||
Reference in New Issue
Block a user